Oracle uses RMAN for data migration

Source: Internet
Author: User
Tags scp command

Oracle uses RMAN for data migration

Overall process: perform A hot backup for the database of machine A, and perform A full backup. Then, use the scp command to upload the backup to machine B, stop database A (note that archive is not triggered when the database is closed), then pass the archive log and redo log to database B, and then restore and recover the database B.

Data File, control file, and parameter file recovery process: According to the database startup process, you can know that the data file is read first. Therefore, you should restore the parameter file first and then read the control file, therefore, you need to repair the control file and then repair the data file. The specific procedure is as follows: 1. Perform A hot full backup for database, RMAN> backup as backupset database include current controlfile plus archivelog format'/u01/app/Oracle/arch _ % U. rmn 'delete all input; province column .... Finished backup at 14-AUG-14 II: Use scp to send the backup to machine B. For example, the Red Command will connect the ENMOEDU of machine A to Oracle/of machine B ,, oracle/ENMOEDU [oracle @ ENMOEDU] $ scp-r/u01/app/oracle/fast_recovery_area/ENMOEDU oracle@192.168.80.11:/u01/app/oracle/
The authenticity of host '192. 168.80.11 (192.168.80.11) 'can't be established.
RSA key fingerprint is 54: 78: 71: 4c: 93: 51: 01: f4: e3: 83: b5: 35: 8f: 9f: d5: b1.
Are you sure you want to continue connecting (yes/no )? Y
Please type 'yes' or 'no': yes
Warning: Permanently added '192. 168.80.11 '(RSA) to the list of known hosts.
Oracle@192.168.80.11's password:
O1_mf_nnndf_SECTION_DF1_9srh9o7k _. bkp 100% 148 36.9 MB MB/s
O1_mf_ncnnf_SECTION_DF1_9srh9ws3 _. bkp 100% 9568KB 9.3 MB/s 01
O1_mf_nnndf_SECTION_DF1_9srh9n9o _. bkp 100% 97 MB 24.2 MB/s
O1_mf_nnsnf_SECTION_DF1_9srh9nml _. bkp 100% 96KB 96.0KB/s
O1_mf_nnndf_SECTION_DF1_9srh9o26 _. bkp 100% 140 28.0 MB MB/s
O1_mf_nnndf_SECTION_DF1_9srh9v71 _. bkp 100% 145 29.0 MB MB/s
O1_mf_nnndf_SECTION_DF1_9srhb0dh _. bkp 100% 81 MB 27.0 MB/s
O1_mf_ncsnf_TAG20140814T203309_9ysc8x14 _. bkp 100% 9600KB 4.7 MB/s
O1_mf_nnndf_TAG20140814T203309_9ysc46go _. bkp 100% 1140 24.3 MB MB/s
Control02.ctl 100% 9520KB 9.3 MB/s
3. Shut down database A and pass archive and redo to database B. (because the database is not closed during backup, new archives and redo will inevitably be generated. To ensure consistency, this step is also required.) 1. SYS @ ENMOEDU> select * from v $ log ,)

GROUP # THREAD # SEQUENCE # BYTES BLOCKSIZE MEMBERS ARC
---------------------------------------------------------------
STATUS FIRST_CHANGE # FIRST_TIM NEXT_CHANGE # NEXT_TIME
-----------------------------------------------------------
1 1 100 52428800 512 1 YES
INACTIVE 1365811 14-AUG-14 1365876 14-AUG-14

2 1 101 52428800 512 1 YES
INACTIVE 1365876 14-AUG-14 1365981 14-AUG-14

3 1 102 52428800 512 1 NO
CURRENT 1365981 14-AUG-14 2.8147E + 14


2. SYS @ ENMOEDU> select * from v $ logfile; # view the specific log location

GROUP # STATUS TYPE
------------------------
MEMBER
--------------------------------------------------------------------------------
IS _
---
1 ONLINE
/U01/app/oracle/oradata/ENMOEDU/redo01.log
NO

2 ONLINE
/U01/app/oracle/oradata/ENMOEDU/redo02.log
NO

GROUP # STATUS TYPE
------------------------
MEMBER
--------------------------------------------------------------------------------
IS _
---

3 ONLINE
/U01/app/oracle/oradata/ENMOEDU/redo03.log
NO [oracle @ ENMOEDU] $ scp/u01/app/oracle/oradata/ENMOEDU/redo03.log oracle@192.168.80.11:/u01/app/oracle
Oracle@192.168.80.11's password:
Redo03.log 100% 50 MB 50.0 MB/s as for archiving, I did not switch the log during the test, or the log group was full, so no archiving was generated, because I added delete all input during the backup, the archive that has been backed up will be deleted, so you will not see the new archive and you will not need to pass it. 4. Operate 1 on machine B, enable the pseudo instance. Do not open the database instance of machine B because my test machine B also has a database. [Oracle @ ENMOEDU ~] $ Set DBID = 87396644 # set database No. RMAN> startup # Start the pseudo instance [oracle @ ENMOEDU] $ rman target/RMAN> restore spfile from '/u01/app/ oracle/ENMOEDU/backupset/2014_08_14/o1_mf_ncsnf_TAG20140814T203309_9ysc8x14 _. bkp '; Starting restore at 15-AUG-14using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID = 20 device type = DISK channel ORA_DISK_1: restoring spfile from AUTOBACKUP/u01/app/oracle/ENMOEDU/backupset/2014_08_14/o1_mf_ncsnf_TAG20140814T203309_9ysc8x14 _. bkpchannel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished restore at 15-AUG-14 [oracle @ ENMOEDU dbs] $ ls # The recovered parameter file is under $ ORACLE_HOME/dbs.
Hc_ENMOEDU2.dat lkDUMMY orapwENMOEDU spfileENMOEDU2.oraRMAN> shutdown immediate # shut down the pseudo instance Oracle instance shut down2. then start the real instance and restore the control file (you should note that it was already in use, delete all files on machine B, including data files, control files, parameter files, and log files.) SQL> startupORACLE instance started. total System Global Area 422670336 bytesFixed Size 1345380 bytesVariable Size 260049052 bytesDatabase Buffers 155189248 bytesRedo Buffers 6086656 bytesORA-00205: error in identifying c Ontrol file, check alert log for more infoRMAN> restore controlfile from '/u01/app/oracle/ENMOEDU/backupset/2014_08_14/o1_mf_ncsnf_tag20140814t203309_9ysc8x_14 _. bkp; Starting restore at 15-AUG-14using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID = 18 device type = DISK channel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore Complete, elapsed time: 00: 00: 01 output file name =/u01/app/oracle/oradata/ENMOEDU/control01.ctloutput file name =/u01/app/oracle/fast_recovery_area/ENMOEDU/control02.ctlFinished restore at 15-AUG-143. open the database to the mount state to repair data files. RMAN> alter database mount; database mountedreleased channel: ORA_DISK_1RMAN> restore database; # An error is reported when data files are recovered. It is likely that the backup has expired, starting restore at 15-AUG-14using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID = 1 device type = DISK creating datafile file number = 1 name =/u01/app/oracle/oradata/ENMOEDU/system01.dbfRMAN-00571: ====================================== ============================================================ RMAN-00569: ================ error message stack follows ============================ RMAN-00571: ========================================================== ============================== RMAN-03002: failure of restore command at 08/15/2014 23: 21: 00ORA-01180: can not create datafile 1ORA-01110: data file 1: '/u01/app/oracle/oradata/ENMOEDU/system01.dbf' RMAN> list backup; # Check the backup information and find that the backup has expired 10 13.85 m disk 00: 00: 02 14-AUG-14 BP Key: 14 Status: EXPIRED Compressed, restore the control file, recover the data file, and then start open.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.