Oracle 12C Transport a Database to a Different Platform Using Backup Sets
可以從源平臺傳輸整個資料庫到有相同位元組序的不同平臺。當為了傳輸資料庫而建立跨平臺備份時,可以在源平臺或目標平臺上執行對資料庫的轉換。在目標平臺執行對資料庫的轉換的最大好處就是執行轉換的開鎖從源平臺轉 移到了目標平臺。
使用備份集執行跨平臺資料庫傳輸的先決條件
在為了跨平臺傳輸資料庫而建立跨平臺備份之前需要滿足以下條件:
.源資料庫與目標資料庫的spfile檔案中的compatible引數必須設定為12.0.0或更高的版本。
.源資料庫必須是read-only模式開啟。
.dbms_tdb.check_db過程必須成功執行。
.源平臺與目標平臺必須有相同的位元組序。
下面的例子將使用備份集執行跨平臺傳輸資料庫,源平臺為Linux 64位,目標平臺為windows 64位其具體操作如下
1.在目標平臺上建立資料庫例項jy
設定環境變數ORACLE_SID
C:\Users\Administrator>set ORACLE_SID=jy
建立例項
C:\Users\Administrator>oradim -new -sid jy -startmode m 輸入 Oracle 服務使用者的口令: 例項已建立。
建立Oracle口令檔案
C:\Users\Administrator>orapwd file=D:\app\oracle\product\12.2.0\dbhome_1\database\pwdjy.ora password=xxzx$7817600 sysbackup=xxzx$7817600
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = jy)
(ORACLE_HOME =D:\app\oracle\product\12.2.0\dbhome_1)
(GLOBAL_DBNAME=jy)
)
)
在tnsnames.ora檔案中增加以下內容
JY = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = WIN-ROUOJ6ERFO3)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jy) (UR = A) ) )
2.利用源資料庫的spfile檔案來為目標資料庫建立spfile檔案
SQL> create pfile='$ORACLE_HOME/dbs/inityyl.ora' from spfile; File created.
將上面生成的inityyl.ora檔案複製到目標平臺D:\app\oracle\product\12.2.0\dbhome_1\database目錄下並將其內容修改成如下所示
*.audit_file_dest='D:\app\oracle\admin\jy\adump' *.cluster_database=false *.compatible='12.2.0' *.control_files='D:\APP\ORACLE\ORADATA\JY\CONTROLFILE\control01.ctl' *.db_block_size=8192 *.db_create_file_dest='D:\app\oracle\oradata\' *.db_name='jy' *.diagnostic_dest='D:\app\oracle\' *.dispatchers='(PROTOCOL=TCP) (SERVICE=jyXDB)' *.enable_pluggable_database=true jy2.instance_number=2 jy1.instance_number=1 *.log_archive_dest_1='location=D:\app\oracle\oradata\arch\jy' *.nls_language='AMERICAN' *.nls_territory='AMERICA' *.open_cursors=300 *.pga_aggregate_target=1g *.processes=2000 *.remote_login_passwordfile='exclusive' *.sga_max_size=2147483648 *.sga_target=2147483648 jy2.thread=2 jy1.thread=1 *.undo_retention=8640 jy1.undo_tablespace='UNDOTBS1' jy2.undo_tablespace='UNDOTBS2'
3.在目標平臺上啟動例項jy
C:\Users\Administrator>sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on 星期四 2月 1 01:23:54 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. 已連線到空閒例程。 SQL> startup nomount ORACLE 例程已經啟動。 Total System Global Area 2147483648 bytes Fixed Size 8920984 bytes Variable Size 1392509032 bytes Database Buffers 738197504 bytes Redo Buffers 7856128 bytes
建立spfile引數檔案並重啟例項到nomount狀態
SQL> create spfile from pfile='D:\app\oracle\product\12.2.0\dbhome_1\database\initjy.ora'; 檔案已建立。 SQL> shutdown immediate ORA-01507: ?????? ORACLE 例程已經關閉。 SQL> startup nomount ORACLE 例程已經啟動。 Total System Global Area 2147483648 bytes Fixed Size 8920984 bytes Variable Size 1392509032 bytes Database Buffers 738197504 bytes Redo Buffers 7856128 bytes SQL> show parameter spfile NAME TYPE VALUE ------------------------------------ ---------------------- ----------------------------------------------------------- spfile string D:\APP\ORACLE\PRODUCT\12.2.0\DBHOME_1\DATABASE\SPFILEJY.ORA
測試tns連線例項jy是否能夠成功
C:\Users\Administrator>sqlplus /nolog SQL*Plus: Release 12.2.0.1.0 Production on 星期四 2月 1 18:01:52 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. SQL> conn sys/abcd@jy as sysdba 已連線。
4.使用有sysdba許可權的使用者透過SQL*Plus連線到源資料庫,並查詢v$transportable_platform來查詢目標平臺的名字,因為傳輸整個資料庫源平臺與目標平臺的位元組序應該相同。
[oracle@jytest1 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Thu Feb 1 18:06:37 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> set long 200 SQL> set linesize 200 SQL> select platform_name,endian_format from v$transportable_platform; PLATFORM_NAME ENDIAN_FORMAT ----------------------------------------------------------------------------------------------------- -------------- Solaris[tm] OE (32-bit) Big Solaris[tm] OE (64-bit) Big Microsoft Windows IA (32-bit) Little Linux IA (32-bit) Little AIX-Based Systems (64-bit) Big HP-UX (64-bit) Big HP Tru64 UNIX Little HP-UX IA (64-bit) Big Linux IA (64-bit) Little HP Open VMS Little Microsoft Windows IA (64-bit) Little IBM zSeries Based Linux Big Linux x86 64-bit Little Apple Mac OS Big Microsoft Windows x86 64-bit Little Solaris Operating System (x86) Little IBM Power Based Linux Big HP IA Open VMS Little Solaris Operating System (x86-64) Little Apple Mac OS (x86-64) Little 20 rows selected.
我這裡源平臺為Linux x86 64-bit,目標平臺為Microsoft Windows IA (64-bit),兩個平臺的位元組序都是Little
5.給RMAN備份輸出檔案選擇命名方法
使用backup命令的format子句來為備份輸出檔案選擇輸出方法。比如使用format子句來為備份輸出檔案指定儲存目錄/ora_backup/tdb並且為每個檔案生成以transport_為字首的唯一檔名。FORMAT '/ora_backup/tdb/transport_%U'
6.啟動RMAN連線到源資料庫(整個RAC CDB)並將重啟源資料庫並以只讀方式開啟。
[oracle@jytest1 tdb]$ rman target sys/abcd0@jy catalog rco/abcd@jypdb_173 Recovery Manager: Release 12.2.0.1.0 - Production on Thu Feb 1 18:37:04 2018 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. connected to target database: JY (DBID=979425723) connected to recovery catalog database RMAN> shutdown immediate starting full resync of recovery catalog full resync complete database closed database dismounted Oracle instance shut down RMAN> startup mount connected to target database: JY (DBID=979425723) database is already started starting full resync of recovery catalog full resync complete RMAN> alter database open read only; starting full resync of recovery catalog full resync complete Statement processed
7.在backup命令中使用for transport或to platform子句來備份源資料庫。下面的例子對整個資料庫建立跨平臺傳輸備份。備份可以被還原到任何與源平臺有相同位元組序的平臺。這裡源平臺為Linux x86 64-bit,因為使用了 for transport子句,那麼對整個資料庫的轉換操作將在目標平臺上執行。跨平臺資料庫備份被儲存在/ora_backup/tdb目錄中。
RMAN> backup for transport format '/ora_backup/tdb/db_transport_%U' database; Starting backup at 01-FEB-18 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00003 name=+DATA/JY/DATAFILE/sysaux.298.962209605 input datafile file number=00009 name=+DATA/JY/DATAFILE/undotbs2.312.962209605 input datafile file number=00004 name=+DATA/JY/DATAFILE/undotbs1.277.962209605 input datafile file number=00001 name=+DATA/JY/DATAFILE/system.317.962209603 input datafile file number=00007 name=+DATA/JY/DATAFILE/users.301.962209605 channel ORA_DISK_1: starting piece 1 at 01-FEB-18 channel ORA_DISK_1: finished piece 1 at 01-FEB-18 piece handle=/ora_backup/tdb/db_transport_7ssq5l1i_1_1 tag=TAG20180201T192745 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:02:05 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00014 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649 input datafile file number=00011 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649 input datafile file number=00013 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649 input datafile file number=00010 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649 input datafile file number=00012 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649 input datafile file number=00015 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609 input datafile file number=00022 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/tts.257.966380353 input datafile file number=00023 name=+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783 channel ORA_DISK_1: starting piece 1 at 01-FEB-18 channel ORA_DISK_1: finished piece 1 at 01-FEB-18 piece handle=/ora_backup/tdb/db_transport_7tsq5l5g_1_1 tag=TAG20180201T192745 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:45 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00017 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409 input datafile file number=00016 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409 input datafile file number=00018 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409 input datafile file number=00019 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409 input datafile file number=00021 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409 input datafile file number=00020 name=+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409 channel ORA_DISK_1: starting piece 1 at 01-FEB-18 channel ORA_DISK_1: finished piece 1 at 01-FEB-18 piece handle=/ora_backup/tdb/db_transport_7usq5l8p_1_1 tag=TAG20180201T192745 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00006 name=+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.962209675 input datafile file number=00005 name=+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.962209675 input datafile file number=00008 name=+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.962209675 channel ORA_DISK_1: starting piece 1 at 01-FEB-18 channel ORA_DISK_1: finished piece 1 at 01-FEB-18 piece handle=/ora_backup/tdb/db_transport_7vsq5lbf_1_1 tag=TAG20180201T192745 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25 Finished backup at 01-FEB-18 [oracle@jytest1 tdb]$ ls -lrt total 5532808 -rw-r----- 1 oracle asmadmin 3146178560 Feb 1 13:27 db_transport_7ssq5l1i_1_1 -rw-r----- 1 oracle asmadmin 990789632 Feb 1 13:29 db_transport_7tsq5l5g_1_1 -rw-r----- 1 oracle asmadmin 988348416 Feb 1 13:30 db_transport_7usq5l8p_1_1 -rw-r----- 1 oracle asmadmin 540270592 Feb 1 13:31 db_transport_7vsq5lbf_1_1
備份源資料庫的控制檔案到跨蹤檔案中用於在目標平臺為目標資料庫重新建立控制檔案
SQL> alter session set tracefile_identifier='create'; Session altered. SQL> alter database backup controlfile to trace resetlogs; Database altered. [root@jytest1 /]# find / -name *create*.trc /u01/app/oracle/diag/rdbms/jy/jy1/trace/jy1_ora_22752_create.trc [root@jytest1 /]# cat /u01/app/oracle/diag/rdbms/jy/jy1/trace/jy1_ora_22752_create.trc Trace file /u01/app/oracle/diag/rdbms/jy/jy1/trace/jy1_ora_22752_create.trc Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production Build label: RDBMS_12.2.0.1.0_LINUX.X64_170125 ORACLE_HOME: /u01/app/oracle/product/12.2.0/db System name: Linux Node name: jytest1.jydba.net Release: 3.8.13-55.1.6.el7uek.x86_64 Version: #2 SMP Wed Feb 11 14:18:22 PST 2015 Machine: x86_64 Instance name: jy1 Redo thread mounted by this instance: 1 Oracle process number: 40 Unix process pid: 22752, image: oracle@jytest1.jydba.net (TNS V1-V3) *** 2018-02-01T23:42:02.696976+08:00 (CDB$ROOT(1)) *** SESSION ID:(6.7558) 2018-02-01T23:42:02.697094+08:00 *** CLIENT ID:() 2018-02-01T23:42:02.697109+08:00 *** SERVICE NAME:(SYS$USERS) 2018-02-01T23:42:02.697120+08:00 *** MODULE NAME:(sqlplus@jytest1.jydba.net (TNS V1-V3)) 2018-02-01T23:42:02.697131+08:00 *** ACTION NAME:() 2018-02-01T23:42:02.697141+08:00 *** CLIENT DRIVER:(SQL*PLUS) 2018-02-01T23:42:02.697150+08:00 *** CONTAINER ID:(1) 2018-02-01T23:42:02.697161+08:00 -- The following are current System-scope REDO Log Archival related -- parameters and can be included in the database initialization file. -- -- LOG_ARCHIVE_DEST='' -- LOG_ARCHIVE_DUPLEX_DEST='' -- -- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf -- -- DB_UNIQUE_NAME="jy" -- -- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG' -- LOG_ARCHIVE_MAX_PROCESSES=4 -- STANDBY_FILE_MANAGEMENT=MANUAL -- STANDBY_ARCHIVE_DEST=?#/dbs/arch -- FAL_CLIENT='' -- FAL_SERVER='' -- -- LOG_ARCHIVE_DEST_1='LOCATION=+TEST/arch' -- LOG_ARCHIVE_DEST_1='OPTIONAL REOPEN=300 NODELAY' -- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM NOVERIFY SYNC' -- LOG_ARCHIVE_DEST_1='REGISTER NOALTERNATE NODEPENDENCY' -- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME' -- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)' -- LOG_ARCHIVE_DEST_STATE_1=ENABLE -- -- The following commands will create a new control file and use it -- to open the database. -- Data used by Recovery Manager will be lost. -- The contents of online logs will be lost and all backups will -- be invalidated. Use this only if online logs are damaged. -- After mounting the created controlfile, the following SQL -- statement will place the database in the appropriate -- protection mode: -- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE "JY" RESETLOGS ARCHIVELOG MAXLOGFILES 192 MAXLOGMEMBERS 3 MAXDATAFILES 1024 MAXINSTANCES 32 MAXLOGHISTORY 292 LOGFILE GROUP 1 '+DATA/JY/ONLINELOG/group_1.261.961976319' SIZE 200M BLOCKSIZE 512, GROUP 2 '+DATA/JY/ONLINELOG/group_2.302.961976321' SIZE 200M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE '+DATA/JY/DATAFILE/system.317.962209603', '+DATA/JY/DATAFILE/sysaux.298.962209605', '+DATA/JY/DATAFILE/undotbs1.277.962209605', '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.962209675', '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.962209675', '+DATA/JY/DATAFILE/users.301.962209605', '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.962209675', '+DATA/JY/DATAFILE/undotbs2.312.962209605', '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649', '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649', '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649', '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649', '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649', '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609', '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409', '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409', '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409', '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409', '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409', '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409', '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/tts.257.966380353', '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783' CHARACTER SET ZHS16GBK ; -- Configure snapshot controlfile filename EXECUTE SYS.DBMS_BACKUP_RESTORE.CFILESETSNAPSHOTNAME('+TEST/jy/snapcf_jy.f'); -- Configure RMAN configuration record 1 VARIABLE RECNO NUMBER; EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('SNAPSHOT CONTROLFILE NAME','TO ''+test/jy/snapcf_jy.f'''); -- Configure RMAN configuration record 2 VARIABLE RECNO NUMBER; EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE','DISK TO ''+test/rman_backup/%F'''); -- Configure RMAN configuration record 3 VARIABLE RECNO NUMBER; EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON'); -- Commands to re-create incarnation table -- Below log names MUST be changed to existing filenames on -- disk. Any one log file from each branch can be used to -- re-create incarnation records. -- ALTER DATABASE REGISTER LOGFILE '+TEST/arch/1_1_934293149.dbf'; -- ALTER DATABASE REGISTER LOGFILE '+TEST/arch/1_1_961976319.dbf'; -- Recovery is required if any of the datafiles are restored backups, -- or if the last shutdown was not normal or immediate. RECOVER DATABASE USING BACKUP CONTROLFILE -- Create log files for threads other than thread one. ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 3 '+DATA/JY/ONLINELOG/group_3.263.961976697' SIZE 200M BLOCKSIZE 512 REUSE, GROUP 4 '+DATA/JY/ONLINELOG/group_4.262.961976705' SIZE 200M BLOCKSIZE 512 REUSE; -- Database can now be opened zeroing the online logs. ALTER DATABASE OPEN RESETLOGS; -- Open all the PDBs. ALTER PLUGGABLE DATABASE ALL OPEN; -- Commands to add tempfiles to temporary tablespaces. -- Online tempfiles have complete space information. -- Other tempfiles may require adjustment. ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/JY/TEMPFILE/temp.299.961976339' SIZE 150994944 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M; ALTER SESSION SET CONTAINER = PDB$SEED; ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/TEMPFILE/temp.297.962209865' SIZE 67108864 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M; ALTER SESSION SET CONTAINER = JYPDB; ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/TEMPFILE/temp.276.962210519' REUSE; ALTER SESSION SET CONTAINER = TESTPDB; ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/TEMPFILE/temp.258.962469435' REUSE; ALTER SESSION SET CONTAINER = CDB$ROOT; -- End of tempfile additions.
8.將在源平臺上使用rman backup命令生成的備份集與備份的控制檔案傳輸到目標平臺的D:\app\oracle\oradata\tdb目錄中
9.使用rman連線到目標資料庫並確保目標資料庫(單例項CDB)處於nomount狀態
C:\Users\Administrator>rman target sys/abcd@jy 恢復管理器: Release 12.2.0.1.0 - Production on 星期四 2月 1 19:55:44 2018 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. 已連線到目標資料庫: JY (未裝載)
10.使用有foreign database子句的restore命令來還原從源平臺傳輸過來的備份集
RMAN> restore from platform 'Linux x86 64-bit' foreign database to new from backupset 'D:\app\oracle\oradata\tdb\db_transport_7ssq5l1i_1_1' backupset 'D:\app\oracle\oradata\tdb \db_transport_7tsq5l5g_1_1' backupset 'D:\app\oracle\oradata\tdb\db_transport_7usq5l8p_1_1' backupset 'D:\app\oracle\oradata\tdb\db_transport_7vsq5lbf_1_1'; 從位於 02-2月 -18 的 restore 開始 使用通道 ORA_DISK_1 通道 ORA_DISK_1: 正在開始還原資料檔案備份集 通道 ORA_DISK_1: 正在指定從備份集還原的資料檔案 通道 ORA_DISK_1: 正在還原備份片段中的所有外部檔案 通道 ORA_DISK_1: 正在讀取備份片段 D:\app\oracle\oradata\tdb\db_transport_7ssq5l1 i_1_1 通道 ORA_DISK_1: 將外部檔案 3 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H4FHX_.DBF 通道 ORA_DISK_1: 將外部檔案 9 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS2_F76H4FHX_.DBF 通道 ORA_DISK_1: 將外部檔案 4 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H4FHX_.DBF 通道 ORA_DISK_1: 將外部檔案 1 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H4FHX_.DBF 通道 ORA_DISK_1: 將外部檔案 7 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H4FJF_.DBF 通道 ORA_DISK_1: 外部片段控制程式碼 = D:\app\oracle\oradata\tdb\db_transport_7ssq5l1i_ 1_1 通道 ORA_DISK_1: 已還原備份片段 1 通道 ORA_DISK_1: 還原完成, 用時: 00:00:56 通道 ORA_DISK_1: 正在開始還原資料檔案備份集 通道 ORA_DISK_1: 正在指定從備份集還原的資料檔案 通道 ORA_DISK_1: 正在還原備份片段中的所有外部檔案 通道 ORA_DISK_1: 正在讀取備份片段 D:\app\oracle\oradata\tdb\db_transport_7tsq5l5 g_1_1 通道 ORA_DISK_1: 將外部檔案 14 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H65NX_.DBF 通道 ORA_DISK_1: 將外部檔案 11 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H65NX_.DBF 通道 ORA_DISK_1: 將外部檔案 13 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDO_2_F76H65NX_.DBF 通道 ORA_DISK_1: 將外部檔案 10 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H65NX_.DBF 通道 ORA_DISK_1: 將外部檔案 12 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H65NX_.DBF 通道 ORA_DISK_1: 將外部檔案 15 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TEST_F76H65NX_.DBF 通道 ORA_DISK_1: 將外部檔案 22 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TTS_F76H65OF_.DBF 通道 ORA_DISK_1: 將外部檔案 23 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_CS_F76H65OF_.DBF 通道 ORA_DISK_1: 外部片段控制程式碼 = D:\app\oracle\oradata\tdb\db_transport_7tsq5l5g_ 1_1 通道 ORA_DISK_1: 已還原備份片段 1 通道 ORA_DISK_1: 還原完成, 用時: 00:00:26 通道 ORA_DISK_1: 正在開始還原資料檔案備份集 通道 ORA_DISK_1: 正在指定從備份集還原的資料檔案 通道 ORA_DISK_1: 正在還原備份片段中的所有外部檔案 通道 ORA_DISK_1: 正在讀取備份片段 D:\app\oracle\oradata\tdb\db_transport_7usq5l8 p_1_1 通道 ORA_DISK_1: 將外部檔案 17 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H70CR_.DBF 通道 ORA_DISK_1: 將外部檔案 16 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H70CR_.DBF 通道 ORA_DISK_1: 將外部檔案 18 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H70D8_.DBF 通道 ORA_DISK_1: 將外部檔案 19 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDO_2_F76H70D8_.DBF 通道 ORA_DISK_1: 將外部檔案 21 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TEST_F76H70D8_.DBF 通道 ORA_DISK_1: 將外部檔案 20 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H70D8_.DBF 通道 ORA_DISK_1: 外部片段控制程式碼 = D:\app\oracle\oradata\tdb\db_transport_7usq5l8p_ 1_1 通道 ORA_DISK_1: 已還原備份片段 1 通道 ORA_DISK_1: 還原完成, 用時: 00:00:16 通道 ORA_DISK_1: 正在開始還原資料檔案備份集 通道 ORA_DISK_1: 正在指定從備份集還原的資料檔案 通道 ORA_DISK_1: 正在還原備份片段中的所有外部檔案 通道 ORA_DISK_1: 正在讀取備份片段 D:\app\oracle\oradata\tdb\db_transport_7vsq5lb f_1_1 通道 ORA_DISK_1: 將外部檔案 6 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H7HXK_.DBF 通道 ORA_DISK_1: 將外部檔案 5 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H7HXK_.DBF 通道 ORA_DISK_1: 將外部檔案 8 還原到 D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H7HXK_.DBF 通道 ORA_DISK_1: 外部片段控制程式碼 = D:\app\oracle\oradata\tdb\db_transport_7vsq5lbf_ 1_1 通道 ORA_DISK_1: 已還原備份片段 1 通道 ORA_DISK_1: 還原完成, 用時: 00:00:16 在 02-2月 -18 完成了 restore
11.在目標平臺上使用備份的控制檔案來為目標資料庫建立控制檔案,將備分的控制檔案記錄的源資料檔案修改成還原後的資料檔名,其建立語句如下
CREATE CONTROLFILE REUSE DATABASE "JY" RESETLOGS ARCHIVELOG MAXLOGFILES 192 MAXLOGMEMBERS 3 MAXDATAFILES 1024 MAXINSTANCES 32 MAXLOGHISTORY 292 LOGFILE GROUP 1 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\redo01.log' SIZE 200M, GROUP 2 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\redo02.log' SIZE 200M -- STANDBY LOGFILE DATAFILE 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_CS_F76H65OF_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H4FHX_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H65NX_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H70CR_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H7HXK_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H4FHX_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H65NX_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H70CR_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H7HXK_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TEST_F76H65NX_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TEST_F76H70D8_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TTS_F76H65OF_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H4FHX_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H65NX_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H70D8_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H7HXK_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS2_F76H4FHX_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDO_2_F76H65NX_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDO_2_F76H70D8_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H4FJF_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H65NX_.DBF', 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H70D8_.DBF' CHARACTER SET ZHS16GBK ;
執行上面的建立語句
SQL> CREATE CONTROLFILE REUSE DATABASE "JY" RESETLOGS ARCHIVELOG 2 MAXLOGFILES 192 3 MAXLOGMEMBERS 3 4 MAXDATAFILES 1024 5 MAXINSTANCES 32 6 MAXLOGHISTORY 292 7 LOGFILE 8 GROUP 1 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\redo01.log' SIZE 200M, 9 GROUP 2 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\redo02.log' SIZE 200M 10 -- STANDBY LOGFILE 11 DATAFILE 12 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_CS_F76H65OF_.DBF', 13 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H4FHX_.DBF', 14 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H65NX_.DBF', 15 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H70CR_.DBF', 16 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H7HXK_.DBF', 17 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H4FHX_.DBF', 18 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H65NX_.DBF', 19 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H70CR_.DBF', 20 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H7HXK_.DBF', 21 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TEST_F76H65NX_.DBF', 22 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TEST_F76H70D8_.DBF', 23 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TTS_F76H65OF_.DBF', 24 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H4FHX_.DBF', 25 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H65NX_.DBF', 26 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H70D8_.DBF', 27 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H7HXK_.DBF', 28 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS2_F76H4FHX_.DBF', 29 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDO_2_F76H65NX_.DBF', 30 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDO_2_F76H70D8_.DBF', 31 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H4FJF_.DBF', 32 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H65NX_.DBF', 33 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H70D8_.DBF' 34 CHARACTER SET ZHS16GBK 35 ; 控制檔案已建立。 SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H4FHX_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H4FHX_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H4FHX_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H7HXK_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H7HXK_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H4FJF_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H7HXK_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS2_F76H4FHX_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H65NX_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H65NX_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H65NX_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDO_2_F76H65NX_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H65NX_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TEST_F76H65NX_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSTEM_F76H70CR_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_SYSAUX_F76H70CR_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDOTBS1_F76H70D8_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_UNDO_2_F76H70D8_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_USERS_F76H70D8_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TEST_F76H70D8_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_TTS_F76H65OF_.DBF D:\APP\ORACLE\ORADATA\JY\DATAFILE\O1_MF_CS_F76H65OF_.DBF 已選擇 22 行。
12.以open resetlogs選項開啟資料庫
SQL> alter database open resetlogs; 資料庫已更改。 SQL> alter pluggable database all open read write; 插接式資料庫已變更。 SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE ---------------------- ------------------------ PDB$SEED READ ONLY JYPDB READ WRITE TESTPDB READ WRITE
13.給CDB資料庫增加臨進表空間資料檔案
SQL> alter tablespace temp add tempfile 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\temp01.dbf' size 100M reuse autoextend on next 655360 maxsize 200m; 表空間已更改。 SQL> alter session set container = pdb$seed; 會話已更改。 SQL> alter tablespace temp add tempfile 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\temp02.dbf' size 100M reuse autoextend on next 655360 maxsize 200m; 表空間已更改。 SQL> alter session set container = jypdb; 會話已更改。 SQL> alter tablespace temp add tempfile 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\temp03.dbf' size 100M reuse; 表空間已更改。 SQL> alter session set container = testpdb; 會話已更改。 SQL> alter tablespace temp add tempfile 'D:\APP\ORACLE\ORADATA\JY\DATAFILE\temp04.dbf' size 100M reuse; 表空間已更改。 SQL> alter session set container = cdb$root; 會話已更改。
到此使用備份集跨平臺傳輸整個CDB資料庫就完成了。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2150759/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 12c RMAN Performing Cross-Platform Transport of a PDB Using InconsistentOracleROSPlatform
- Oracle 12C RMAN Cross-Platform Transport of PDBsOracleROSPlatform
- Oracle 12c RMAN Cross-Platform Transport of a Closed PDBOracleROSPlatform
- 12C Duplicating a Database to a Remote Host by Using Backup-based DuplicationDatabaseREM
- Using RMAN REPORT NEED BACKUP with Different Retention Policies
- oracle create a new database using backup controlfile to traceOracleDatabase
- recover database using backup controlfileDatabase
- Migrate to different Endian Platform Using TTS With RMAN-371556.1PlatformTTS
- recover database using backup controlfile理解Database
- recover database using backup control fileDatabase
- oracle full database backupOracleDatabase
- DUPLICATE (Backup based) DATABASE from non ASM to ASM to different host_382669.1DatabaseASM
- recover database until cancel using backup controlfileDatabase
- Recover database using backup controlfile until cancelDatabase
- recover database using backup controlfile與 recover database 的區別Database
- Oracle Database 12c Release 2 (12.2) RAC On Oracle Linux 7 Using VMwareOracleDatabaseLinux
- Using Sorted Sets with Jedis APIAPI
- Using Regular Expressions in Oracle DatabaseExpressOracleDatabase
- Oracle 11G support different OS Platform DataGaurd ( windows and linux )OraclePlatformWindowsLinux
- oracle 12c 資料歸檔 即Using In-Database Archiving featureOracleDatabase
- oracle實驗記錄 (oracle 10G rman transport database)OracleDatabase
- recover database using backup controlfile利用archivelog files.DatabaseHive
- The different between cumulative and differential incremental backupREM
- How to move progress database to different OSDatabase
- Oracle 12c: Recover tables using RMANOracle
- Oracle 12C RMAN transport tablespace from PDB of RAC CDB to remote PDBOracleREM
- Oracle OCP 1Z0 053 Q428(transport database)OracleDatabase
- Oracle Database 12C New FeatureOracleDatabase
- How to check whether the current database in using Oracle optionsDatabaseOracle
- For oracle databases, if the top showing the oracle database, then oracle process is using the top cOracleDatabase
- Rman backup standby databaseDatabase
- Cold Database backup scriptDatabase
- Important Changes to Oracle Database Patch Sets Starting With 11.2.0.2_1189783.1ImportOracleDatabase
- oracle database backup and recovery user's guide part IVOracleDatabaseGUIIDE
- oracle database backup and recovery user's guide part IIIOracleDatabaseGUIIDE
- Oracle 12Cr2 Using CloneDB to clone a databaseOracleDatabase
- zt:Different type of RMAN backup compression in 11G
- Oracle 12C Database File Mapping for Oracle ASM FilesOracleDatabaseAPPASM