oracle11g using Rman for instance migrations in the Azure cloud

Source: Internet
Author: User
Tags chmod reserved




1, start Backup

Backup script rman_full_backup.sh content such as the following :

#!/bin/shexport date= ' DATE +%f ' export back_dir= '/backupdisk/backup/data ' su-oracle-c ' mkdir-p $BACK _dir/$DATErman Log = $BACK _dir/$DATE/rman_backup.log target/<<eofrun{        backup as compressed backupset database                format ' $ back_dir/$DATE/full_%d_%t_%s.bak '        plus archivelog                 format ' $BACK _dir/$DATE/arch_%d_%t_%s.bak ' delete input;        SQL ' alter system archive log current ';} Crosscheck backup;crosscheck archivelog all;delete noprompt expired backup;delete noprompt expired Archivelog all;delete  NoPrompt obsolete;exiteof "Su-oracle-c" chmod 775 $BACK _dir/$DATE/* "#cd/home/pdbcakup/echo" begin to copy the backup to  PD servers. ">>  /tmp/oracle_fullback.log#cp-r $BACK _dir/$DATE/home/pdbcakupecho" End to copy the backup to PD Server. ">>  /tmp/oracle_fullback.log


Backup steps such as the following are seen:

[[Email protected]_90 ~]# bash-x/oracle/backup/scripts/rman_full_backup.sh++ date +%F+ export DATE=2016-03-17+ date=2016-03-17+ export back_dir=/oracle/backup/data+ back_dir=/oracle/backup/data+ su-oracle-c ' mkdir-p/oracle/ Backup/data/2016-03-17rman log=/oracle/backup/data/2016-03-17/rman_backup.log target/<<EOFrun{backup as Co mpressed backupset database format ' \ '/oracle/backup/data/2016-03-17/full_%d_%t_%s.bak ' plus arc        Hivelog format ' \ '/oracle/backup/data/2016-03-17/arch_%d_%t_%s.bak ' \ ' delete input; SQL ' \ ' alter system archive log current ' \ ';} Crosscheck backup;crosscheck archivelog all;delete noprompt expired backup;delete noprompt expired Archivelog all;delete noprompt obsolete;exitEOF‘RMAN> 2> 3> 4> 5> 6> 7> RMAN> RMAN> RMAN> RMAN> RMAN> RMAN&g T + su-oracle-c ' chmod 775/oracle/backup/data/2016-03-17/* ' + echo ' begin to copy the backup to PD servers. ' + Echo ' End To copy the backup to PD server. ' [[Email protected]_90 ~]# LL



2. View the backed up Files folder
Rman> list Backup of controlfile;using target database control file instead of recovery cataloglist of backup sets===== ==============bs Key type LV Size Device Type Elapsed Time completion time------------------------------------ -------------------------6 full 1.05M DISK 00:00:01 17-mar-16 BP key:6 status:a vailable compressed:yes tag:tag20160317t202130 Piece Name:/oracle/backup/data/2016-03-17/full_powerdes_2016031 7_15.bak Control File included:ckp scn:31576216 Ckp time:17-mar-16rman> list Backup of SPFile; List of Backup sets===================bs Key type LV Size Device Type Elapsed Time completion time--------------              -----------------------------------------------6 full 1.05M DISK 00:00:01 17-mar-16 BP key:6 status:available compressed:yes tag:tag20160317t202130 Piece Name:/oracle/backup/data/2016-03- 17/full_powerdes_20160317_15.bak SPFILEIncluded:modification time:17-mar-16 SPFILE db_unique_name:powerdesrman> [[email protected]_90 ~]$ Rlwrap SQL  Plus/as sysdbasql*plus:release 11.2.0.1.0 Production on Thu Mar 21:08:32 2016Copyright (c) 1982,----Oracle. All rights reserved.  Connected to:oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit productionwith The partitioning, OLAP, Data Mining and Real Application testing optionssql> sql> create pfile= '/oracle/pfile_20160317.ora ' from SPFile; File created. Sql>


Original Blog address: http://blog.csdn.net/mchdba/article/details/50990181 without the permission of the original author Mchdba (Douglas fir). Declined reprint.




3, Transmission
[Email protected]_90 ~]$ scp-p50390-r/oracle/pfile_20160317.ora 2016-03-17 192.168.237.46:/oracle/backup/the Authenticity of host ' [192.168.237.46]:50390 ([192.168.237.46]:50390) ' can ' t be established. RSA key fingerprint is c0:1c:30:8a:bd:8c:90:b2:af:57:1d:29:ab:1f:90:f9. Is you sure want to continue connecting (yes/no)?

Yeswarning:permanently added ' [192.168.237.46]:50390 ' (RSA) to the list of known hosts. [email protected] ' s Password:pfile_20160317.ora 100% 1008 1.0kb/s 00:00 [[Email protec Ted]_90 ~]$ [[email protected]_90 data]$ scp-p50390-r 2016-03-17 192.168.237.46:/oracle/backup/[email  Protected] ' s Password:full_POWERDES_20160317_14.bak 100% 1914MB 4.7mb/s 06:49 Full_powerdes_20160317_15.bak 100% 1088KB 1.1mb/s 00:00 Arch_powerdes_20160317_16.bak 100% 180KB 179.5kb/s 00:00 rman_backup.log 100% 6331 6.2kb/s 00:00 [[email  Protected]_90 data]$



4, go to the target Library Nomount mode to start the database
sql> shutdown Immediateora-01507:database not mountedoracle instance shut down. sql> startup Nomount pfile= '/oracle/backup/pfile_20160317.ora '; Oracle instance started. Total System Global area 1603411968 bytesfixed size    2213776 bytesvariable size 1023412336 bytesdatabase buffers  5 70425344 Bytesredo Buffers    



5, Recovery control file



6. Change the database state to mount:



7, register backup files
rman> catalog start with '/ORACLE/BACKUP/2016-03-17 '; Starting implicit crosscheck backup at 17-mar-16allocated channel:ora_disk_1channel ora_disk_1:sid=134 device Type=DISK crosschecked 4 objectsfinished Implicit crosscheck backup at 17-mar-16starting implicit crosscheck copy at 17-MAR-16using Channel ora_disk_1finished implicit crosscheck copy at 17-mar-16searching-All files in the recovery areacataloging fil es...no files catalogedsearching for all files this match the pattern/oracle/backup/2016-03-17list of files Unknown to th E database=====================================file Name:/oracle/backup/2016-03-17/rman_backup.logfile Name:/ Oracle/backup/2016-03-17/arch_powerdes_20160317_16.bakfile Name:/oracle/backup/2016-03-17/full_powerdes_ 20160317_15.bakfile Name:/oracle/backup/2016-03-17/full_powerdes_20160317_14.bakdo You really want to catalog the Above files (enter YES or NO)? Yescataloging files...cataloging donelist of cataloged files=======================file Name:/Oracle/backup/2016-03-17/arch_powerdes_20160317_16.bakfile Name:/oracle/backup/2016-03-17/full_powerdes_ 20160317_15.bakfile Name:/oracle/backup/2016-03-17/full_powerdes_20160317_14.baklist of Files Which Where not Cataloged=======================================file Name:/oracle/backup/2016-03-17/rman_backup.log RMAN-07517:  Reason:the file header is corruptedrman>




8. Start running the restore restore operation. To write data from a backup set to a polygon in a data file on disk, restoring a data file that has been backed up

rman> Restore Database; Starting restore at 17-mar-16using target database control file instead of recovery catalogallocated channel:ora_disk_1ch Annel ora_disk_1:sid=133 device Type=diskchannel ora_disk_1:starting datafile backup set Restorechannel ora_disk_1:spec Ifying datafile (s) to restore from backup Setchannel ora_disk_1:restoring datafile 00001 to/data/oracle/orclstu/system01 . Dbfchannel ora_disk_1:restoring datafile 00002 to/data/oracle/orclstu/sysaux01.dbfchannel ora_disk_1:restoring DataFile 00003 to/data/oracle/orclstu/undotbs01.dbfchannel ora_disk_1:restoring datafile 00004 to/data/oracle/ Orclstu/users01.dbfchannel ora_disk_1:restoring datafile 00005 to/data/oracle/orclstu/orclstuk01.dbfchannel ORA_ disk_1:restoring datafile 00006 to/data/oracle/orclstu/plas01.dbfchannel ora_disk_1:restoring datafile 00007 to/data/ Oracle/orclstu/plcrm01.dbfchannel ora_disk_1:restoring datafile 00008 to/data/oracle/orclstu/pl01.dbfchannel ORA_ Disk_1:restoring DataFile 000To/data/oracle/orclstu/help01.dbfchannel ora_disk_1:reading from backup Piece/oracle/backup/2016-03-17/full_ Powerdes_20160317_14.bakchannel ora_disk_1:piece Handle=/oracle/backup/2016-03-17/full_powerdes_20160317_14.bak Tag=tag20160317t202130channel ora_disk_1:restored backup piece 1channel ora_disk_1:restore complete, elapsed time:00:1 4:25finished Restore at 17-mar-16rman>



9, apply archive log to recover data files
rman> Recover database; Starting recover at 17-mar-16using Channel ora_disk_1starting media recoverychannel ora_disk_1:starting archived log Rest Ore to default Destinationchannel ora_disk_1:restoring archived logarchived log thread=1 Sequence=1428channel ORA_DISK_1 : Reading from backup Piece/oracle/backup/2016-03-17/arch_powerdes_20160317_16.bakchannel ora_disk_1:piece handle=/ Oracle/backup/2016-03-17/arch_powerdes_20160317_16.bak Tag=tag20160317t202918channel ora_disk_1:restored Backup Piece 1channel Ora_disk_1:restore complete, elapsed time:00:00:03archived log file Name=/oracle/app/oracle/flash_ Recovery_area/powerdes/archivelog/2016_03_17/o1_mf_1_1428_cgog3ons_.arc thread=1 sequence=1428channel Default: Deleting archived log (s) archived log file name=/oracle/app/oracle/flash_recovery_area/powerdes/archivelog/2016_03_ 17/o1_mf_1_1428_cgog3ons_.arc recid=2 stamp=906760822unable to find archived logarchived log thread=1 sequence= 1429rman-00571: ===========================================================rman-00569: =============== ERROR MESSAGE STACK follows ===============rman-00571: ========= ==================================================rman-03002:failure of recover command at 03/17/2016 22:00:29rman-06054:media recovery requesting unknown archived log for thread 1 with sequence 1429 and starting SCN of 315  76222rman>


you need to copy the missing archive logs from the original backup library to the Microsoft Cloud Azure Oracle Server, or directly to the SCN point:




10. Open the Database




11, verify the database
[[Email protected]_crm admin]$ more Tnsnames.ora # Tnsnames.ora Network Configuration File:/oracle/app/oracle/ product/11.2.0/dbhome_1/network/admin/tnsnames.ora# Generated by Oracle configuration tools. Powerdes = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521)) (Connect_data = (SERVER = dedicated) (service_name = Orclstu))) CRM390 = (DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.158.3.91) (PORT = 1521))) (Connect_data = (service_name = orclstu))) [[Email protecte D]_crm admin]$ [[Email protected]_crm admin]$ rlwrap sqlplus orclstuk/[email protected];  Sql*plus:release 11.2.0.1.0 Production on Thu Mar 22:15:41 2016Copyright (c) 1982,----Oracle. All rights reserved.  Connected to:oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit productionwith The partitioning, OLAP, Data Mining and Real Application testing optionssql> CREATE TABLE Z_te (ID number); TabLe created. sql> INSERT into Z_te (ID) values (1); 1 row created. Sql> commit; Commit complete. Sql> SELECT * from Z_te;id----------1sql> drop table z_te; Table dropped.   Sql> SELECT * FROM Z_te;select * from Z_te *error @ line 1:ora-00942:table or view does not existsql>


oracle11g using Rman for instance migrations in the Azure cloud

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.