Offsite Rman Recovery Database

Source: Internet
Author: User

Source DB End:

Oracle_base=/u01/app/oracle

Oracle_home=/u01/app/oracle/product/11.2.0/db_1

Oracle_sid=ygdg

Data File location:/U01/APP/ORACLE/ORADATA/YGDG

Target DB End:

Oracle_base=/u01/app/oracle

Oracle_home=/u01/app/oracle/product/11.2.0/db_1

Oracle_sid=ygdg

Data File location:/U01/APP/ORACLE/ORADATA/YGDG

"1. Original repository Rman Backup"

[email protected] rman]$ cat rman_for_dg.sh

Export ORACLE_SID=YGDG

Export Oracle_base=/u01/app/oracle

Export Oracle_home=/u01/app/oracle/product/11.2.0/db_1

Export Nls_lang=american_america. Zhs16gbk

Rman target=/log= '/u01/ygtest/fullbackup.log ' <<eof

Crosscheck Archivelog All;

Run

{

Allocate channel T1 type disk;

Allocate channel T2 type disk;

Allocate channel T3 type disk;

Allocate channel T4 type disk;

Backup as compressed backupset database format '/u01/ygtest/db%d%s%p%t.bak ' tag= ' WHOLE BACKUP ' Section size 30G

Plus archivelog format '/u01/ygtest/arc%d%s%p%t.bak ' tag= ' ARC BACKUP ' delete input;

Backup current controlfile format '/u01/ygtest/ctl%d%s%p%t.bak ' tag= ' CTL BACKUP ';

Release channel T1;

Release channel T2;

Release channel T3;

Release channel T4;

}

Crosscheck backup;

Delete noprompt Obsolete recovery window of 3 days;

Eof

"2. Original Library View dbid"

Export ORACLE_SID=YGDG

Rman target=/

After the connection, you can see the dbid, write it down.

"3. The original library generates Pfile"

Create pfile= '/u01/pfileygdg.ora ' from SPFile;

"4. backup file to target library"

Scp/u01/ygtest/*.bak [Email protected]:/u01/ygtest Remember to determine the directory permissions and the owner

"5. The original library target library is modified with pfile, and the modified parameter file is uploaded to the target end"

It is recommended to download the original library generated pfile and target library spfile to local, according to "parameter location see Pfile, other see SPFile" principle to modify

"6. The target database creates SPFile and uses SPFile to start the database to Nomount State"

If the above parameter modification is not a problem, the normal should be the following:

sql> startup pfile= '/software/pfileygdg.ora ';

Sql> create SPFile from pfile= '/software/pfileygdg.ora ';

sql> shutdown immediate;

sql> startup Nomount;

But some parameters do not pay attention to the changes, there will be ora-, do not worry, see what is wrong to change the line, as follows:

sql> startup pfile= '/software/pfileygdg.ora ';

The ORACLE routine has been started.

Total System Global area 221331456 bytes

Fixed Size 2251856 bytes

Variable Size 163578800 bytes

Database buffers 50331648 bytes

Redo buffers 5169152 bytes

Ora-00201:control file version 11.2.0.4.0 incompatible with ORACLE version 11.2.0.0.0

Ora-00202:control file: '/u01/app/oracle/oradata/ygdg/control01.ctl '

Analysis: View parameter file compatible value is 11.2.0.0.0, conflict with the value in the control file;

Solve:

Sql> create SPFile from pfile= '/software/pfileygdg.ora ';

The file was created.

sql> shutdown immediate;

ORA-01507:??????

The ORACLE routine has been closed.

FIX: After modifying the SPFile file compatible parameter, use SPFile to start

sql> startup Nomount;

Ora-01078:failure in processing system parameters

Lrm-00109:could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initygdg.ora '

The workaround for this problem is to go to the cd/u01/app/oracle/admin/ygdg/pfile/directory and init.ora.25201817331

Copy to DBS directory:

CP Init.ora.25201817331/u01/app/oracle/product/11.2.0/db_1/dbs/initygdg.ora

sql> startup Nomount;

The ORACLE routine has been started.

Total System Global area 830930944 bytes

Fixed Size 2257800 bytes

Variable Size 536874104 bytes

Database buffers 285212672 bytes

Redo buffers 6586368 bytes

Sql> exit

From Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-64bit Production

With the partitioning, OLAP, Data Mining and Real application testing options Disconnect

"7. Restore Control Files"

[Email protected] database]$ Rman target=/

Recovery manager: Release 11.2.0.4.0-production on Monday March 5 19:20:26 2018

Copyright (c) 1982, Oracle and/or its affiliates. All rights reserved.

Connected to target database: YGDG (not mounted)

Rman> Set dbid=2428115541

rman> restore Controlfile from '/software/ygtest/ctl_ygdg_55_1_969977274.bak ';

Rman> ALTER DATABASE Mount;

"8. Specify the directory where the backup files are located"

rman> catalog start with '/software/ygtest ';

"9. Restoring and recovering a database"

Rman> run{

Set newname for datafile 1 to "/u01/app/oracle/oradata/ygdg/system01.dbf";

Set newname for datafile 2 to "/u01/app/oracle/oradata/ygdg/sysaux01.dbf";

Set newname for DataFile 3 to "/u01/app/oracle/oradata/ygdg/undotbs01.dbf";

Set newname for datafile 4 to "/u01/app/oracle/oradata/ygdg/users01.dbf";

Set newname for datafile 5 to "/u01/app/oracle/oradata/ygdg/test01.dbf";

Set newname for Tempfile 1 to "/u01/app/oracle/oradata/ygdg/temp01.dbf";

SQL "ALTER DATABASE RENAME FILE"/u01/app/oracle/oradata/ygdg/redo01a.log "to"/u01/app/oracle/oradata/ygdg/ Redo01a.log ' ";

SQL "ALTER DATABASE RENAME FILE"/u01/app/oracle/oradata/ygdg/redo02a.log "to"/u01/app/oracle/oradata/ygdg/ Redo02a.log ' ";

}

Rman> run{

Restore database;

SWITCH datafile All;

Recover database;

} # Update control file with new filenames

Note: 1. Original library execution

Sql> Select ' Set newname for datafile ' | | a.file# | | ' To ' | | A.name | | ‘";‘

From V$datafile a UNION ALL select ' Set newname for tempfile ' | | a.file# | | ' To ' | | A.name | | '; ' from V$tempfile A;

' Setnewnamefordatafile ' | | a.file#| | ' To "' | | a.name| | '; '

Set newname for datafile 1 to "/u01/app/oracle/oradata/ygdg/system01.dbf";

Set newname for datafile 2 to "/u01/app/oracle/oradata/ygdg/sysaux01.dbf";

Set newname for DataFile 3 to "/u01/app/oracle/oradata/ygdg/undotbs01.dbf";

Set newname for datafile 4 to "/u01/app/oracle/oradata/ygdg/users01.dbf";

Set newname for datafile 5 to "/u01/app/oracle/oradata/ygdg/test01.dbf";

Set newname for Tempfile 1 to "/u01/app/oracle/oradata/ygdg/temp01.dbf";

6 rows have been selected.

Sql>

Select ' SQL ' ALTER DATABASE RENAME FILE ' ' | | A.member | | ' To ' ' | | A.member | | ‘‘‘‘‘ ";‘ From V$logfile A;

SQL "ALTER DATABASE RENAME FILE" '/u01/app/oracle/oradata/ygdg/redo01a.log ' to

'/u01/app/oracle/oradata/ygdg/redo01a.log ';

SQL "ALTER DATABASE RENAME FILE" '/u01/app/oracle/oradata/ygdg/redo02a.log ' to

'/u01/app/oracle/oradata/ygdg/redo02a.log ';

2. Use Newnam for datafile to modify different file paths

3.switch datafile All is used to update the data file path in the restored controlfile and the online log file path, otherwise recover will be error RMAN-06094

[Email protected] database]$ Sqlplus/as SYSDBA

Sql> select status from V$instance;

STATUS

Mounted

sql> ALTER DATABASE open resetlogs;

The database has changed.

Offsite Rman Recovery Database

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.