6.oracle Database Recovery

Source: Internet
Author: User
Tags sessions oracle database sqlplus

1.1 Oracle Database Recovery

Directory

1 Installing a new client
2 Creating a new machine recovery file
3 Creating a new DB instance
4 Setting up SPFile files
5 Creating a Data folder
6 Starting the database to the Nomount state
7 List Backup Information
8 Restore Controlfile, and Mount database
9 Finding data file information
10 Data File Recovery
11 Archive Log Recovery
12 Online Log Path modification
Recover and open the database
14 Verifying the database

1.1.1 installation The new client

Adding hosts information on the backup server

10.110.10.74 Backup-test

Adding hosts information to the client

10.12.69.111 Nbu-b

Install client side

1.1.2 New built different Machine Recover Files

Establish a file on the backup server that supports the requirements for a different machine recovery .

Backup Server established no.restrictions Empty file

UNIX Platform:/usr/openv/netbackup/db/altnames/no.restrictions

1.1.3 New Build Database Example

For machines that need to be recovered, a new database instance needs to be created for data recovery.

The instance of this recovery pin is test

1.1.4 Establish spfile file

The original SPFile export file is:

[email protected] testtest]# cat Inittest1.ora.old

test2.__db_cache_size=7918845952

test1.__db_cache_size=6643777536

test2.__java_pool_size=134217728

test1.__java_pool_size=134217728

test2.__large_pool_size=167772160

test1.__large_pool_size=167772160

Test1.__oracle_base= '/oracle/' #ORACLE_BASE set from environment

Test2.__oracle_base= '/oracle/' #ORACLE_BASE set from environment

test2.__pga_aggregate_target=6442450944

test1.__pga_aggregate_target=5637144576

test2.__sga_target=9663676416

test1.__sga_target=10468982784

Test2.__shared_io_pool_size=0

Test1.__shared_io_pool_size=0

test2.__shared_pool_size=1342177280

test1.__shared_pool_size=3422552064

Test2.__streams_pool_size=0

Test1.__streams_pool_size=0

*.audit_file_dest= '/oracle/admin/test/adump '

*.audit_trail= ' DB '

*.cluster_database=true

*.compatible= ' 11.2.0.4.0 '

*.control_files= ' +data_dg/test/controlfile/current.256.834077963 ', ' +data_dg/test/controlfile/ current.275.834330051 ', ' +flash_dg/test/controlfile/current.278.834330403 '

*.db_block_size=8192

*.db_create_file_dest= ' +DATA_DG '

*.db_domain= "

*.db_name= ' Test '

*.diagnostic_dest= '/oracle '

*.dispatchers= ' (protocol=tcp) (SERVICE=TESTXDB) '

Test1.instance_number=1

test2.instance_number=2

*.lock_sga=false

*.log_archive_dest_1= ' LOCATION=+FLASH_DG '

*.log_archive_format= '%t_%s_%r.dbf '

*.memory_max_target=16106127360

*.memory_target=16106127360

*.open_cursors=500

*.processes=1000

*.remote_listener= ' test-scan:1521 '

*.remote_login_passwordfile= ' Exclusive '

*.session_cached_cursors=100

*.sessions=1105

test2.thread=2

Test1.thread=1

*.undo_retention=7200

Test1.undo_tablespace= ' UNDOTBS1 '

Test2.undo_tablespace= ' UNDOTBS2 '

Delete RAC-related information because you need to restore to a single machine . In addition , due to different hardware resources, delete the resource configuration that needs to be restored.

The new configuration file is

[[email protected] testtest]# cat inittest1.ora

*.__oracle_base= '/ oradata/testtest/' #ORACLE_BASE set from environment

*.__pga_aggregate_target=5637144576

*.__sga_ target=10468982784

*.audit_file_dest= '/oradata/testtest/adump '

*.audit_trail= ' db '

*. compatible= ' 11.2.0.4.0 '

*.control_files= '/oradata/testtest/controlfile/current.256.834077963 '

*.db _block_size=8192

*.db_create_file_dest= '/oradata/testtest/'

*.db_domain= '

*.db_name= ' test '

*.diagnostic_dest= '/oradata/testtest/'

*.dispatchers= ' (protocol=tcp) (service=testxdb) '

*. Lock_sga=false

*.log_archive_dest_1= ' location=/oradata/testtest/archive/'

*.log_archive_format= '%t _%s_%r.dbf '

*.open_cursors=500

*.processes=1000

*.remote_login_passwordfile= ' exclusive '

*.session_cached_cursors=100

*.sessions=1105

*.undo_retention=7200

*.undo_tablespace= ' UNDOTBS1 '

1.1.5 Establish Data Files Clamp

establish relevant documents according to SPFile

[Email protected] testtest]# ll-a

Total 52

DRWXRWXRWX 7 Oracle Oinstall 4096 SEP 25 16:26.

Drwxrwxr-x Oracle Oinstall 12288 Sep 28 10:03.

Drwxr-xr-x 2 Oracle Oinstall 4096 SEP 10:37 adump

Drwxr-xr-x 2 Oracle Oinstall 4096 SEP 16:02 Archive

Drwxr-xr-x 2 Oracle Oinstall 4096 SEP 10:10 controlfile

Drwxrwxr-x 3 Oracle Oinstall 4096 SEP 16:20 diag

-RWXRWXRWX 1 Oracle Oinstall 760 SEP 16:26 Inittest1.ora

-rwxr-xr-x 1 Oracle Oinstall 1578 SEP 15:45 inittest1.ora.old

DRWXRWXRWX 2 Oracle Oinstall 4096 SEP 12:04 testtest

-RWXRWXRWX 1 Oracle Oinstall 6520 SEP 14:44 utlpwdmg.sql

1.1.6 Start Database to nomount Status

Sqlplus/nolog

Idle> Conn/as SYSDBA

idle> startup Nomount pfile= '/oradata/testtest/inittest1.ora '

idle> startup Nomount pfile= '/oradata/testtest/inittest1.ora '

ORACLE instance started.

Total System Global area 396726272 bytes

Fixed Size 2253504 bytes

Variable Size 318770496 bytes

Database buffers 67108864 bytes

Redo buffers 8593408 bytes

1.1.7 List Backups Information

List related backup information on the backup server

Bplist-c test-db01-s 09/27/2015-t 4-r-b-l/

。。。。。。。

1.1.8 restore C Ontrolfile , and Mount Database

RMAN Restore

Rman>

Rman>connect Target/

Rman> run{

2> Allocate channel ch0 type ' Sbt_tape ';

3> send ' nb_ora_client=test-db01 ';

4> send ' nb_ora_serv=nbu-b ';

5> restore Controlfile from '/cntrl_3175_1_891580028 ';

6> release channel Ch0;

7>}

Using target database control file instead of recovery catalog

Allocated Channel:ch0

Channel ch0:sid=578 Device Type=sbt_tape

Channel Ch0:veritas NetBackup for Oracle-release 7.6 (2014102721)

Sent command to Channel:ch0

Sent command to Channel:ch0

Starting restore at 2015-09-28 10:10:36

Channel ch0:restoring Control File

Channel Ch0:restore complete, elapsed time:00:00:15

Output File name=/oradata/testtest/controlfile/current.256.834077963

Finished restore at 2015-09-28 10:10:52

Released Channel:ch0

Rman> ALTER DATABASE Mount;

Database mounted

1.1.9 Find data File Information

Sqlplus/nolog

Idle> Conn/as SYSDBA

Idle> select name from V$datafile;

NAME

----------------------------------------------------------------------------------------------------

+data_dg/test/datafile/system.259.834077963

+data_dg/test/datafile/sysaux.260.834077967

+data_dg/test/datafile/undotbs1.261.834077971

+data_dg/test/datafile/undotbs2.263.834077979

+data_dg/test/datafile/users.264.834077981

+data_dg/test/datafile/zhos_dataspace.268.889894605

+data_dg/test/datafile/zhos_dataspace.272.834956161

+data_dg/test/datafile/zhos_dataspace.271.834956199

+data_dg/test/datafile/spcred_dataspace.269.834956241

+data_dg/test/datafile/zhos_indexspace.273.834317857

+data_dg/test/datafile/audit_dataspace.280.846839715

One by one rows selected.

Idle> Select member from V$logfile;

MEMBER

----------------------------------------------------------------------------------------------------

+data_dg/test/onlinelog/group_1.257.834077963

+data_dg/test/onlinelog/group_2.258.834077963

+data_dg/test/onlinelog/group_3.265.834080437

+data_dg/test/onlinelog/group_4.266.834080437

+data_dg/test/onlinelog/group_5.276.834332677

+data_dg/test/onlinelog/group_6.277.834332723

+data_dg/test/onlinelog/group_7.278.834332751

+data_dg/test/onlinelog/group_8.279.834332783

8 rows selected.

1.1.10 Data file recovery

Edit the restore script as follows:

Export Oracle_sid=test

Rman <<eof

Connect Target/

Run {

Allocate channel Ch0 type ' Sbt_tape ';

Allocate channel CH1 type ' Sbt_tape ';

Send ' nb_ora_serv=nbu-b ';

Send ' nb_ora_client=test-db01 ';

Set newname for datafile ' +data_dg/test/datafile/system.259.834077963 ' to '/oradata/testtest/system.259.834077963 ';

Set newname for datafile ' +data_dg/test/datafile/sysaux.260.834077967 ' to '/oradata/testtest/sysaux.260.834077967 ';

Set newname for datafile ' +data_dg/test/datafile/undotbs1.261.834077971 ' to '/oradata/testtest/ undotbs1.261.834077971 ';

Set newname for datafile ' +data_dg/test/datafile/undotbs2.263.834077979 ' to '/oradata/testtest/ undotbs2.263.834077979 ';

Set newname for datafile ' +data_dg/test/datafile/users.264.834077981 ' to '/oradata/testtest/users.264.834077981 ';

Set newname for datafile ' +data_dg/test/datafile/zhos_dataspace.268.889894605 ' to '/oradata/testtest/zhos_ dataspace.268.889894605 ';

Set newname for datafile ' +data_dg/test/datafile/zhos_dataspace.272.834956161 ' to '/oradata/testtest/zhos_ dataspace.272.834956161 ';

Set newname for datafile ' +data_dg/test/datafile/zhos_dataspace.271.834956199 ' to '/oradata/testtest/zhos_ dataspace.271.834956199 ';

Set newname for datafile ' +data_dg/test/datafile/spcred_dataspace.269.834956241 ' to '/oradata/testtest/spcred_ dataspace.269.834956241 ';

Set newname for datafile ' +data_dg/test/datafile/zhos_indexspace.273.834317857 ' to '/oradata/testtest/zhos_ indexspace.273.834317857 ';

Set newname for datafile ' +data_dg/test/datafile/audit_dataspace.280.846839715 ' to '/oradata/testtest/audit_ dataspace.280.846839715 ';

Restore database;

Switch datafile all;

Release channel Ch0;

Release channel CH1;

}

Exit

Eof

Run data Restore

Recovery Complete

1.1.11 Archive Log Recovery

Idle> Select Thread#,sequence#,first_time,completion_time from V$archived_log where Completion_time>to_date (' 20150927 20:00:00 ', ' yyyymmdd hh24:mi:ss ') and Completion_time<to_date (' 20150928 6:00:00 ', ' yyyymmdd hh24:mi:ss ') Order BY sequence#;

thread# sequence# First_time Completion_time

---------- ---------- ------------------- -------------------

1 27587 2015-09-27 19:59:31 2015-09-27 21:01:28

......

The selected rows.

RMAN Restores archive logs

node 1 Restore

Rman> Connect Target/

Connected to target Database:test (dbid=825185095, not open)

Rman> run{

Set Archivelog destination to '/oradata/testtest/archive ';

2> 3> Allocate channel ch0 type ' Sbt_tape ';

Send ' nb_ora_client=test-db01 ';

Send ' nb_ora_serv=nbu-b ';

Restore Archivelog sequence between 27587 and 27597 thread 1;

4> 5> 6> 7> release channel Ch0;

8>}

Executing command:set ARCHIVELOG DESTINATION

......

Released Channel:ch0

Node 2 restore

Rman> run{

Set Archivelog destination to '/oradata/testtest/archive ';

2> 3> Allocate channel ch0 type ' Sbt_tape ';

4> send ' nb_ora_client=test-db01 ';

5> send ' nb_ora_serv=nbu-b ';

6> restore Archivelog sequence between 45287 and 45314 thread 2;

7> release channel Ch0;

8>}

Executing command:set ARCHIVELOG DESTINATION

Allocated Channel:ch0

Channel ch0:sid=673 Device Type=sbt_tape

Channel Ch0:veritas NetBackup for Oracle-release 7.6 (2014102721)

Sent command to Channel:ch0

Sent command to Channel:ch0

Starting restore at 2015-09-28 14:14:04

Channel ch0:starting archived log restore to user-specified destination

......

Released Channel:ch0

1.1.12 Online Log Path Modification

Sqlplus Modification

Idle>

Alter DATABASE rename file ' +data_dg/test/onlinelog/group_1.257.834077963 ' to '/oradata/testtest/group_ 1.257.834077963 ';

......

1.1.13 R Ecover and Open Database

Sqlplus starting the database

idle> recover database until cancel using Backup controlfile;

Ora-00279:change 10315737932005 generated at 09/27/2015 22:03:45 needed for thread 1

Ora-00289:suggestion:/oradata/testtest/archive/1_27589_834077959.dbf

Ora-00280:change 10315737932005 for thread 1 are in sequence #27589

Specify log: {<ret>=suggested | AUTO | CANCEL}

AUTO

Ora-00308:cannot Open archived log '/oradata/testtest/archive/1_27589_834077959.dbf '

Ora-27037:unable to obtain file status

linux-x86_64 error:2: No such file or directory

Additional Information:3

..............

Ora-00308:cannot Open archived log '/oradata/testtest/archive/2_45315_834077959.dbf '

Ora-27037:unable to obtain file status

linux-x86_64 error:2: No such file or directory

Additional Information:3

Idle>

idle> ALTER DATABASE open resetlogs;

Database altered.

1.1.14 Validation Database

Idle> select Open_mode from V$database;

Open_mode

----------------------------------------

READ WRITE

6.oracle Database Recovery

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.