时间:2021-07-01 10:21:17 帮助过:37人阅读
对ArcSDE for Oracle数据库来说,数据迁移包括的方式比较多:逻辑迁移、冷备份、热备份、RMAN,当然也包括ArcGIS本身的Copy/Paste方式,那么在Oracle12c这个新的版本也引入了PDB和CDB的概念,感兴趣的用户可以查看Oracle12c的官方帮助。 今天介绍的就是使用O
对ArcSDE for Oracle数据库来说,数据迁移包括的方式比较多:逻辑迁移、冷备份、热备份、RMAN,当然也包括ArcGIS本身的Copy/Paste方式,那么在Oracle12c这个新的版本也引入了PDB和CDB的概念,感兴趣的用户可以查看Oracle12c的官方帮助。
今天介绍的就是使用Oracle12c新特性的方法来京CDB中的PDB迁移到另外一个CDB中。对PDB的概念,一般大家认为是可插入式的数据库,就像你使用U盘原来在别人的电脑上,现在从别人电脑上拔出,然后插入你自己的电脑上,这种方式也就是相当于数据的迁移。
测试环境:
源环境:
Redhat 5.5 、Oracle12.1.0.1(CDB:orcl 、PDB:pdborcl)、 ArcSDE10.2.1 、192.168.220.203
目标环境:
Windows Server2012、Oracle12.1.0.1(CDB:orcl、PDB:pdborcl1和pdborcl2 )、ArcSDE10.2.1、192.168.100.213
我的Linux环境下的ArcSDE10.2.1 for Oracle12c的业务数据已经导入,而且可读可写,所在的PDB为pdborcl,希望将这个pdborcl迁移到Window环境下。
----------------------------------------------------------------------------------
Blog: http://blog.csdn.net/linghe301
----------------------------------------------------------------------------------
迁移原理:将Linux环境的PDB生成一个描述该PDB的XML元数据文件,然后将该PDB的相关数据文件和该XML元数据文件拷贝到Windows机器上,在创建新的PDB使用这些XML元数据文件和数据文件即可。
1:查看Linux环境的PDB状态
[oracle@oracle12c orcl]$ sqlplus sys/oracle@orcl as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Sat Feb 15 06:30:09 2014 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- /home/oracle/app/oracle/oradata/orcl/system01.dbf /home/oracle/app/oracle/oradata/orcl/sysaux01.dbf /home/oracle/app/oracle/oradata/orcl/undotbs01.dbf /home/oracle/app/oracle/oradata/orcl/pdbseed/system01.dbf /home/oracle/app/oracle/oradata/orcl/users01.dbf /home/oracle/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf /home/oracle/app/oracle/oradata/orcl/pdborcl/system01.dbf /home/oracle/app/oracle/oradata/orcl/pdborcl/sysaux01.dbf /home/oracle/app/oracle/oradata/orcl/pdborcl/SAMPLE_SCHEMA_users01.dbf /home/oracle/app/oracle/oradata/orcl/pdborcl/example01.dbf /home/oracle/app/oracle/product/orcl/pdborcl/sde01 NAME -------------------------------------------------------------------------------- /home/oracle/app/oracle/oradata/orcl/esri.dbf /home/oracle/app/oracle/oradata/orcl/pdborcl/esri.dbf /home/oracle/app/oracle/oradata/orcl/pdborcl/esri2.dbf 14 rows selected. SQL> select con_id,dbid,NAME,OPEN_MODE from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 4062262812 PDB$SEED READ ONLY 3 2266793495 PDBORCL MOUNTED
2:导出Linux环境的PDB的元数据文件
SQL> alter pluggable database pdborcl unplug into '/home/oracle/pdborcl.xml'; Pluggable database altered. SQL> !ls /home/oracle app database Desktop pdborcl.xml
3:将Linux环境的导出的XML文件和PDBORCL的数据文件物理拷贝到Windows环境下。默认的路径为c:\pdborcl.xml和c:\pdborcl\*.dbf。
4:打开相关的pdborcl.xml
PDBORCL 3 1 202375168 2266793495 1347416737 E07706C816463582E043CB64A8C060C6 2025944 0 4194824 SYSTEM 0 0 1 0 8 1 1735344 0 1 35840 8192 202375168 2266793495 0 2025942 0 1720082 819636003 SYSAUX 0 1 1 0 9 4 1735347 0 1 80640 8192 202375168 2266793495 0 2025942 0 1720082 819636003 TEMP 1 2 1 0 128 3 1 1735345 0 0 2560 8192 202375168 14194302 80 USERS 0 3 1 0 10 9 1735350 0 1 640 8192 202375168 2266793495 0 2025942 0 1720082 819636003 EXAMPLE 0 4 1 0 11 10 1735352 0 1 45840 8192 202375168 2266793495 0 2025942 0 1720082 819636003 SDE 0 5 1 0 13 13 1750711 0 1 51200 8192 202375168 2266793495 0 2025942 0 1720082 819636003 ESRI 0 6 1 0 15 15 1833964 0 1 128000 8192 202375168 2266793495 0 2025942 0 1720082 819636003 ESRI2 0 7 1 0 16 16 1842823 0 1 12800 8192 202375168 2266793495 0 2025942 0 1720082 819636003 178 2000 0 0 0 4.2.0.00.27:1processes=300 memory_target=843055104 db_block_size=8192 compatible=12.1.0.0.0 open_cursors=300 enable_pluggable_database=TRUE primary version:18 secondary version:0 0
----------------------------------------------------------------------------------
Blog: http://blog.csdn.net/linghe301
----------------------------------------------------------------------------------
5:使用创建PDB语句
C:\Users\Administrator>sqlplus sys/oracle@localhost/orcl as sysdba SQL*Plus: Release 12.1.0.1.0 Production on 星期五 2月 28 22:59:53 2014 Copyright (c) 1982, 2013, Oracle. All rights reserved. 连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics and Real Application Testing options SQL> select con_id,dbid,name,open_mode from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 4083344342 PDB$SEED READ ONLY 3 1246209042 PDBORCL1 MOUNTED 4 1218627613 PDBORCL2 MOUNTED SQL> create pluggable database pdbsde using 'C:\pdborcl.xml' copy file_name_conv ert=('/home/oracle/app/oracle/oradata/orcl/pdborcl/','C:\app\oracle\oradata\orcl \pdborcl\'); create pluggable database pdbsde using 'C:\pdborcl.xml' copy file_name_convert=( '/home/oracle/app/oracle/oradata/orcl/pdborcl/','C:\app\oracle\oradata\orcl\pdbo rcl\') * 第 1 行出现错误: ORA-19505: 无法识别文件"/home/oracle/app/oracle/oradata/orcl/pdborcl/system01.dbf" ORA-27041: 无法打开文件 OSD-04002: 无法打开文件 O/S-Error: (OS 3) 系统找不到指定的路径。
6:将pdborcl.xml文件里面的数据文件路径修改为存储在Windows环境的实际路径,如c:\pdborcl\sde01等,而且在数据文件参数设置也应该设置为Windows路径下,而且这些数据文件的目的存储为C:\app\oracle\oradata\orcl\pdborcl\
该步骤涉及到数据文件的拷贝,根据数据量大小时间有所不一样
SQL> create pluggable database pdbsde using 'C:\pdborcl.xml' copy file_name_conv ert=('c:\pdborcl\','C:\app\oracle\oradata\orcl\pdborcl\'); 插接式数据库已创建。
7:打开新的PDB(pdbsde)并查看状态
[oracle@oracle12c orcl]$ sqlplus sys/oracle@orcl as sysdba SQL*Plus: Release 12.1.0.1.0 Production on Sat Feb 15 06:30:09 2014 SQL> select con_id,dbid,name,open_mode from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 4083344342 PDB$SEED READ ONLY 3 1246209042 PDBORCL1 MOUNTED 4 1218627613 PDBORCL2 MOUNTED 5 2266793495 PDBSDE MOUNTED SQL> alter pluggable database pdbsde open; 插接式数据库pdbsde已打开 SQL> select con_id,dbid,name,open_mode from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 4083344342 PDB$SEED READ ONLY 3 1246209042 PDBORCL1 MOUNTED 4 1218627613 PDBORCL2 MOUNTED 5 2266793495 PDBSDE READ WRITE8:使用sqlplus 连接sde用户
SQL> conn sde/sde@192.168.100.213/pdbsde ERROR: ORA-01035: ORACLE ???êDí??óD RESTRICTED SESSION è¨?Tμ?ó??§ê1ó? 警告: 您不再连接到 ORACLE。提示ORA-01035错误,需要赋予RESTRICTED SESSION权限
SQL> conn system/oracle@192.168.100.213/pdbsde 已连接。 SQL> grant restricted session to sde; 授权成功。 SQL> conn sde/sde@192.168.100.213/pdbsde 已连接。9:使用ArcCatalog10.2.1进行读写测试
总结:个人感觉,该方面有点类似于Oracle的冷备份,不过在实施过程中操作比较简单,尤其是ArcGIS版本化数据的迁移,既保证了简单操作性又保持了高效,值得用户进行参考!
----------------------------------------------------------------------------------
Blog: http://blog.csdn.net/linghe301
----------------------------------------------------------------------------------