Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use RMAN to recover the whole database

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to use RMAN to recover the entire database". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Using RMAN to restore the whole database case 1

Suitable for the situation: the restored directory is the same, and there are archived logs in the backup process.

The restored database directory is the same as the downmachine database, and another is that the archive log has been backed up when RMAN is backed up.

Backup script:

Run {

Allocalte channel ch2 type disk

Sql 'alter system archive log current'

Backup as compressed backupset database format'/ u02According to RMAN TestDB% Trout% U'

Sql 'alter system archive log current'

Backup as compressed backupset archivelog all format'/ u02According to RMAN starcking% Turing% U'

Bakup current controlfile format'/ u02According to rmandeband testcontexts% Trout% U'

Release channel ch2

}

Delete force noprompt expired backup

Delete force noprompt obsoelet

1. Install Oracle server software

The version corresponds to each other as far as possible, and during the installation process, you choose to install only the software and not create the database.

two。 Set environment variabl

Su-oracle

Vim / .bash_profile

Export ORACLE_BASE=/u01/app/oracle

Export ORACLE_HOME=/u01/app/oracle/10g/db_1

Export ORACLE_SID=test-- this must correspond.

Export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

Unset USERNAME

Effective: source ~ / .bash_profile

3. Create the corresponding directories and files, which are the same as those of the previous server. The information can be seen in the log file backed up by rman, including the following:

Mkdir $ORACLE_BASE/admin/SID/ {arecinct brecinct cjorie u} dump-p

Mkdir $ORACLE_BASE/admin/SID/pfile-p

Mkdir $ORACLE_BASE/oradata/SID-p

Create a password file:

Orapwd file=$ORACLE_HOME/dbs/orapwtest password=oracle entires=10

4. Copy the backup and archive to the path corresponding to the recovery machine, especially the path of rman backup, otherwise an error will be reported.

5. Configure hostname, listening, IP

6. The process of restoring a database

1) rman target / nocatalog

Recovery Manager: Release 10.2.0.4.0-Production on Thu Sep 16 13:55:31 2010

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to target database (not started)

2) RMAN > startup nomount

Startup failed: ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file'/ u01qqapp.oracle.oracle10g _ Universe _ db_

Starting Oracle instance without parameter file for retrival of spfile

Oracle instance started

The above means: there is no initialization parameter file required by the instance. Since there is no parameter file, an error will be reported, but the instance has been started.

Total System Global Area 159383552 bytes

Fixed Size 1266344 bytes

Variable Size 54529368 bytes

Database Buffers 100663296 bytes

Redo Buffers 2924544 bytes

3) restore initialization parameter files

It should be noted here that to find the corresponding backup files, try them one by one, generally looking for smaller ones after backup comparison.

RMAN > restore spfile from'/ u02 RMANGAMAN TestDB 20100916 05lo1lg01LG011'

Starting restore at 16-SEP-10

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=36 devtype=DISK

Channel ORA_DISK_1: autobackup found: / u02/rman/testdb_20100916_05lo1lg0_1_1

Channel ORA_DISK_1: SPFILE restore from autobackup complete

Finished restore at 16-SEP-10

4) restore control files

RMAN > shutdown immediate

Oracle instance shut down

RMAN > startup nomount

Connected to target database (not started)

Oracle instance started

Total System Global Area 167772160 bytes

Fixed Size 1266392 bytes

Variable Size 62917928 bytes

Database Buffers 100663296 bytes

Redo Buffers 2924544 bytes

RMAN > restore controlfile from'/ u02 RAMAN TestConverse 2010091607lo1lg81lg8111'

Starting restore at 16-SEP-10

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=101 devtype=DISK

Channel ORA_DISK_1: restoring control file

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:02

Output filename=/u01/app/oracle/oradata/test/control01.ctl

Output filename=/u01/app/oracle/oradata/test/control02.ctl

Output filename=/u01/app/oracle/oradata/test/control03.ctl

Finished restore at 16-SEP-10

5) start the data to mount state

RMAN > alter database mount

Database mounted

Released channel: ORA_DISK_1

6) restore the database

The following error means that individual logs are out of sync, so it is best to copy the whole archive together.

RMAN > run {

2 > restore database

3 > recover database

4 >}

7) Open the database with resetlogs

[oracle@sdb dbs] $sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0-Production on Thu Sep 16 14:02:58 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL > alter database open resetlogs

Database altered.

If there is a problem in the process of database recovery, you can refer to the following steps

After restoring the control file, start to mount and run the following query at the sqlplus prompt

1. Sql > select file#,checkpoint_change# from v$datafile

Note: if the checkpoint_change# column cannot be displayed by scientific notation, you can make it display completely by using the following command

Set numw 15

It is found that the checkpoint scn of all data files is 52873354, so archive logs with scn greater than 52873354 are needed to repair the database.

two。 Run list backup of archivelog all at the rman prompt and find that the sequence range for archive logs with scn greater than 52873354 is 1052 to 1097, running at the rman prompt

Restore archivelog sequence between 1052 and 1097; recover archive log (mount)

3. Run the command alter database flashback off; to close flashback at the sqlplus prompt, and then run the following command block to repair the database at the rman prompt

Rman > Run {

Set until sequence=1098

Retore database

Recover database

}

Using RMAN to restore the whole database case 2

Suitable for occasions: consistent directories, no archived backups

The restored database directory is the same as the downmachine database. There is no backup and archiving during RMAN backup. During recovery, you should copy all the subsequent archives of the database as far as possible, which is consistent with the current backup strategy of some servers in the company.

Note: before making a database backup, there is only the hello,hell2,hello4,hello3 table under the user test/test. After the backup is completed, the table hello5 is created, combined with RMAN and archive log to restore, and verify that after the backup is restored, the hello5 table also exists.

Backup script:

Run {

Allocate channel ch2 type disk

Sql 'alter system archive log current'

Backup as compressed backupset database format'/ u02According to RMAN TestDB% Trout% U'

Sql 'alter system archive log current'

Backup current controlfile format'/ u02According to rmandeband testcontexts% Trout% U'

Release channel ch2

}

The recovery process is as follows:

One of them is the same as the above process, and the following is the process of recovering data in step 5:

6. Using rman to recover

[oracle@sdb test] $rman target / nocatalog

Recovery Manager: Release 10.2.0.4.0-Production on Sun Sep 19 12:02:47 2010

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to target database (not started)

1) restore spfile, usually find small backup files

RMAN > startup nomount

Startup failed: ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file'/ u01qqapp.oracle.oracle10g _ Universe _ db_

Starting Oracle instance without parameter file for retrival of spfile

Oracle instance started

Total System Global Area 159383552 bytes

Fixed Size 1266344 bytes

Variable Size 54529368 bytes

Database Buffers 100663296 bytes

Redo Buffers 2924544 bytes

RMAN > restore spfile from'/ u02 RMANG TestDB 20100919 0llo9foo1'

Starting restore at 19-SEP-10

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=36 devtype=DISK

Channel ORA_DISK_1: autobackup found: / u02/rman/testdb_20100919_0llo9foo_1_1

Channel ORA_DISK_1: SPFILE restore from autobackup complete

Finished restore at 19-SEP-10

RMAN > shutdown immediate

Oracle instance shut down

RMAN > startup nomount

Connected to target database (not started)

Oracle instance started

Total System Global Area 167772160 bytes

Fixed Size 1266392 bytes

Variable Size 75500840 bytes

Database Buffers 88080384 bytes

Redo Buffers 2924544 bytes

-- indicates that the recovery is successful

2) restore control files

RMAN > restore controlfile from'/ u02 RAMAN TestConverse 2010091900 0mlo9fovcards 1mlo1'

Starting restore at 19-SEP-10

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=101 devtype=DISK

Channel ORA_DISK_1: restoring control file

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:02

Output filename=/u01/app/oracle/oradata/test/control01.ctl

Output filename=/u01/app/oracle/oradata/test/control02.ctl

Output filename=/u01/app/oracle/oradata/test/control03.ctl

Finished restore at 19-SEP-10

3) start the database to mount state and restore the database

RMAN > alter database mount

Database mounted

Released channel: ORA_DISK_1

RMAN > run {

2 > allocate channel ch2 type disk

3 > restore database

4 > recover database

5 > release channel ch2

6 >}

Allocated channel: ch2

Channel ch2: sid=101 devtype=DISK

Starting restore at 19-SEP-10

Channel ch2: starting datafile backupset restore

Channel ch2: specifying datafile (s) to restore from backup set

Restoring datafile 00001 to / u01/app/oracle/oradata/test/system01.dbf

Restoring datafile 00002 to / u01/app/oracle/oradata/test/undotbs01.dbf

Restoring datafile 00003 to / u01/app/oracle/oradata/test/sysaux01.dbf

Restoring datafile 00004 to / u01/app/oracle/oradata/test/users01.dbf

Channel ch2: reading from backup piece / u02/rman/testdb_20100919_0klo9fna_1_1

Channel ch2: restored backup piece 1

Piece handle=/u02/rman/testdb_20100919_0klo9fna_1_1 tag=TAG20100919T110514

Channel ch2: restore complete, elapsed time: 00:00:36

Finished restore at 19-SEP-10

Starting recover at 19-SEP-10

Starting media recovery

Released channel: ch2

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-03002: failure of recover command at 09/19/2010 13:36:12

RMAN-06053: unable to perform. Media recovery because of missing log

RMAN-06025: no backup of log thread 1 seq 38 lowscn 493029 found to restore

RMAN-06025: no backup of log thread 1 seq 37 lowscn 492908 found to restore

RMAN-06025: no backup of log thread 1 seq 36 lowscn 492874 found to restore

It says that no archival files were found, so copy as many archived documents as possible.

RMAN > exit

4) use SQL*PLUS to recover the contents of the archive log

Recovery Manager complete.

[oracle@sdb test] $sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0-Production on Sun Sep 19 13:36:28 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL > recover database using backup controlfile

ORA-00279: change 492881 generated at 09/19/2010 11:05:14 needed for thread 1

ORA-00289: suggestion: / u01/arclog/1_36_729861888.dbf

ORA-00280: change 492881 for thread 1 is in sequence # 36

AUTO first and then CANCLE

Specify log: {= suggested | filename | AUTO | CANCEL}

Auto

ORA-00279: change 492908 generated at 09/19/2010 11:06:07 needed for thread 1

ORA-00289: suggestion: / u01/arclog/1_37_729861888.dbf

ORA-00280: change 492908 for thread 1 is in sequence # 37

ORA-00278: log file'/ u01 no longer needed for this arclog no longer needed for this

Recovery

ORA-00279: change 493029 generated at 09/19/2010 11:07:40 needed for thread 1

ORA-00289: suggestion: / u01/arclog/1_38_729861888.dbf

ORA-00280: change 493029 for thread 1 is in sequence # 38

ORA-00278: log file'/ u01 no longer needed for this arclog no longer needed for this

Recovery

ORA-00308: cannot open archived log'/ u01amp arclog Universe 1 "38" 729861888.dbf'

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

SQL > recover database using backup controlfile

ORA-00279: change 493029 generated at 09/19/2010 11:07:40 needed for thread 1

ORA-00289: suggestion: / u01/arclog/1_38_729861888.dbf

ORA-00280: change 493029 for thread 1 is in sequence # 38

Specify log: {= suggested | filename | AUTO | CANCEL}

Cancel

Media recovery cancelled.

SQL > alter database open resetlogs

Alter database open resetlogs

*

ERROR at line 1:

ORA-01113: file 1 needs media recovery

ORA-01110: data file 1:'/ u01 *

-- the error message above is normal to say that the system01.dbf file needs to be media recovery. Since the information in the archive has just been applied, it will report an error, and then enter the recover database in the RMAN.

SQL > exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@sdb test] $rman target / nocatalog

Recovery Manager: Release 10.2.0.4.0-Production on Sun Sep 19 13:38:51 2010

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to target database: TEST (DBID=2028008317, not open)

Using target database control file instead of recovery catalog

RMAN > recover database

Starting recover at 19-SEP-10

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=104 devtype=DISK

Starting media recovery

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-03002: failure of recover command at 09/19/2010 13:38:58

RMAN-06053: unable to perform. Media recovery because of missing log

RMAN-06025: no backup of log thread 1 seq 38 lowscn 493029 found to restore

-- the error message above is that the log of seq 38 was not found and will not be affected.

RMAN > exit

Recovery Manager complete.

5) the test is restored successfully

[oracle@sdb test] $sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0-Production on Sun Sep 19 13:39:06 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL > shutdown immediate;-- it's best to perform a shutdown before

SQL > startup

SQL > alter database open resetlogs

Database altered.

SQL > conn test/test

SQL > select table_name from user_tables

TABLE_NAME

-

HELLO2

HELLO

HELLO3

HELLO4

HELLO5

SQL > select count (*) from hello5

COUNT (*)

-

153600

In fact, from 3), 4), 5) steps can be restored like this, first of all, copy the archive as much as possible to the corresponding directory of the archive.

Then perform the following steps:

Rman > alter database mount

Rman > run {

Restore database

}

Rman > catalog start with'/ u03Universe backupUniverse arcbak

Rman > recover database

Rman > shutdown immediate

Rman > startup

Rman > alter database open reseglogs

Method 3: copy those archives directly to the same directory as the original library, and then do the following:

Rman > alter database mount

Rman > run {

Restore database

Recover database

}

Rman > alter database open resetlogs

Rman > shutdown immediate

Rman > startup

Finally, check ps-ef | number of processes in the grep ora_ instance. If there are too many processes, don't pay too much attention to them. It's just the reason why the database has not been fully restored.

Using RMAN to restore the whole database case 3

Inconsistent recovery directories

This is generally not necessary when the database directory is different, but sometimes there is a special need

Backup script:

Run {

Allocate channel ch2 type disk

Sql 'alter system archive log current'

Backup as compressed backupset database format'/ u02According to RMAN TestDB% Trout% U'

Sql 'alter system archive log current'

Backup as compressed archivelog all format'/ u02According to RMAN starcking% Turing% U'

Backup current controlfile format'/ u02According to rmandeband testcontexts% Trouu'

Release channel ch2

}

Crosscheck backup

Delete force noprompt obsolete

1, 2, 3, 4, 5, the process is basically the same as that of case 1.

The following is the recovery process:

[oracle@sdb rman] $rman target / nocatalog

Recovery Manager: Release 10.2.0.4.0-Production on Sun Sep 19 17:08:33 2010

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to target database (not started)

1) restore spfile files

RMAN > startup nomount

Connected to target database (not started)

Startup failed: ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file'/ u01qqapp.oracle.oracle10g _ Universe _ db_

Starting Oracle instance without parameter file for retrival of spfile

Oracle instance started

Total System Global Area 159383552 bytes

Fixed Size 1266344 bytes

Variable Size 54529368 bytes

Database Buffers 100663296 bytes

Redo Buffers 2924544 bytes

RMAN > restore spfile from'/ u02 RMANG TestDB 2010091900 0slo9uv51mm 1'

Starting restore at 19-SEP-10

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=36 devtype=DISK

Channel ORA_DISK_1: autobackup found: / u02/rman/testdb_20100919_0slo9uv5_1_1

Channel ORA_DISK_1: SPFILE restore from autobackup complete

Finished restore at 19-SEP-10

3) restore controlfile

RMAN > shutdown immediate

Oracle instance shut down

RMAN > startup nomount

Connected to target database (not started)

Oracle instance started

Total System Global Area 167772160 bytes

Fixed Size 1266392 bytes

Variable Size 88083752 bytes

Database Buffers 75497472 bytes

Redo Buffers 2924544 bytes

RMAN > restore controlfile from'/ u02 RAMAN TestConverse 20100919,0ulo9uvdwords 1o1'

Starting restore at 19-SEP-10

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=101 devtype=DISK

Channel ORA_DISK_1: restoring control file

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

Output filename=/u01/app/oracle/oradata/test/control01.ctl

Output filename=/u01/app/oracle/oradata/test/control02.ctl

Output filename=/u01/app/oracle/oradata/test/control03.ctl

Finished restore at 19-SEP-10

4) restore the database (restore,recover)

RMAN > alter database mount

Database mounted

Released channel: ORA_DISK_1

RMAN > report schema

Starting implicit crosscheck backup at 19-SEP-10

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: sid=101 devtype=DISK

Crosschecked 7 objects

Finished implicit crosscheck backup at 19-SEP-10

Starting implicit crosscheck copy at 19-SEP-10

Using channel ORA_DISK_1

Finished implicit crosscheck copy at 19-SEP-10

Searching for all files in the recovery area

Cataloging files...

No files cataloged

RMAN-06139: WARNING: control file is not current for REPORT SCHEMA

Report of database schema

List of Permanent Datafiles

= =

File Size (MB) Tablespace RB segs Datafile Name

1 0 SYSTEM * / u01/app/oracle/oradata/test/system01.dbf

2 0 UNDOTBS1 * / u01/app/oracle/oradata/test/undotbs01.dbf

3 0 SYSAUX * / u01/app/oracle/oradata/test/sysaux01.dbf

4 0 USERS * / u01/app/oracle/oradata/test/users01.dbf

List of Temporary Files

=

File Size (MB) Tablespace Maxsize (MB) Tempfile Name

-

1 0 TEMP 32767 / u01/app/oracle/oradata/test/temp01.dbf

RMAN > run {

2 > set newname for datafile 1 to'/ u03max oradata Universe TestUnip system01.dbf'

3 > set newname for datafile 2 to'/ u03max oradata Universe TestUniverse undotbs01.dbf'

4 > set newname for datafile 3 to'/ u03Universe oradataUniplicateSysaux01.dbf'

5 > set newname for datafile 4 to'/ u03max oradata Universe TestUniverse users01.dbf'

6 > restore datafile 1, 2, 3, 4

7 > switch datafile all

8 >}

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Starting restore at 19-SEP-10

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting datafile backupset restore

Channel ORA_DISK_1: specifying datafile (s) to restore from backup set

Restoring datafile 00001 to / u03/oradata/test/system01.dbf

Restoring datafile 00002 to / u03/oradata/test/undotbs01.dbf

Restoring datafile 00003 to / u03/oradata/test/sysaux01.dbf

Restoring datafile 00004 to / u03/oradata/test/users01.dbf

Channel ORA_DISK_1: reading from backup piece / u02/rman/testdb_20100919_0rlo9utn_1_1

Channel ORA_DISK_1: restored backup piece 1

Piece handle=/u02/rman/testdb_20100919_0rlo9utn_1_1 tag=TAG20100919T152439

Channel ORA_DISK_1: restore complete, elapsed time: 00:00:36

Finished restore at 19-SEP-10

Datafile 1 switched to datafile copy

Input datafile copy recid=5 stamp=730143305 filename=/u03/oradata/test/system01.dbf

Datafile 2 switched to datafile copy

Input datafile copy recid=6 stamp=730143305 filename=/u03/oradata/test/undotbs01.dbf

Datafile 3 switched to datafile copy

Input datafile copy recid=7 stamp=730143305 filename=/u03/oradata/test/sysaux01.dbf

Datafile 4 switched to datafile copy

Input datafile copy recid=8 stamp=730143305 filename=/u03/oradata/test/users01.dbf

RMAN > alter database mount

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-03002: failure of alter db command at 09/19/2010 17:35:25

ORA-01100: database already mounted

RMAN > recover database

Starting recover at 19-SEP-10

Using channel ORA_DISK_1

Starting media recovery

Archive log thread 1 sequence 43 is already on disk as file / u01/arclog/1_43_729861888.dbf

Archive log thread 1 sequence 44 is already on disk as file / u01/arclog/1_44_729861888.dbf

Archive log filename=/u01/arclog/1_43_729861888.dbf thread=1 sequence=43

Archive log filename=/u01/arclog/1_44_729861888.dbf thread=1 sequence=44

Unable to find archive log

Archive log thread=1 sequence=45

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-03002: failure of recover command at 09/19/2010 17:36:40

RMAN-06054: media recovery requesting unknown log: thread 1 seq 45 lowscn 500916

RMAN > alter database open resetlogs

Database opened

RMAN > exit

Recovery Manager complete.

5) so far, the data file, and the initialization parameter file, the control file has been restored, but the control file is still saved in the previously recorded directory, as well as the redo,temp file. Here is the recovery process of these files:

[oracle@sdb ~] $sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0-Production on Sun Sep 19 17:37:44 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

A. view the status of the current log

SQL > select group#,status from v$log

Delete archive logs that are not in use, and then add them back

SQL > alter database drop logfile group 2

SQL > alter database add logfile group 2'/ u03Universe oradata size 50m

SQL > alter database drop logfile group 3

SQL > alter database add logfile group 3'/ u03Universe oradata size 50m

Note that when deleting archive 1, you must change its status to INACTIVE before you can delete archive 1, otherwise it will indicate that the current archive is not finished yet.

SQL > select group#,status from v$log

SQL > alter system archive log current

SQL > select group#,status from v$log

SQL > alter system archive log current

SQL > select group#,status from v$log

SQL > alter system archive log current

SQL > select group#,status from v$log

SQL > alter system archive log current

SQL > select group#,status from v$log

SQL > alter database drop logfile group 1

SQL > alter database add logfile group 1'/ u03Universe oradata size 50m

SQL > select * from v$logfile

Look at the information above. Redo online log was restored successfully.

B. restore controlfile files

SQL > create pfile='/home/oracle/inittest.ora' from spfile;-- back up spfile first

SQL > shutdown immediate

[oracle@sdb ~] $vim inittest.ora-where colors are added, such as * dump_dest directories can also be modified as needed, as well as archive directories.

Test.__db_cache_size=75497472

Test.__java_pool_size=4194304

Test.__large_pool_size=4194304

Test.__shared_pool_size=79691776

Test.__streams_pool_size=0

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

* .background_dump_dest='/u01/app/oracle/admin/test/bdump'

* .compatible='10.2.0.3.0'

* .control_files='/u03/oradata/test/control01.ctl','/u03/oradata/test/control02.ctl','/u03/oradata/test/control03.ctl'#Restore Controlfile

* .core_dump_dest='/u01/app/oracle/admin/test/cdump'

* .db_block_size=8192

* .db_domain=''

* .db_file_multiblock_read_count=16

* .db_name='test'

* .db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

* .db_recovery_file_dest_size=2147483648

* .dispatchers=' (PROTOCOL=TCP) (SERVICE=testXDB)'

* .job_queue_processes=10

* .log_archive_dest_1='LOCATION=/u03/arclog'

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

* .open_cursors=300

* .pga_aggregate_target=16777216

* .processes=100

* .remote_login_passwordfile='EXCLUSIVE'

* .sessions=115

* .sga_target=167772160

* .undo_management='AUTO'

* .undo_tablespace='UNDOTBS1'

* .user_dump_dest='/u01/app/oracle/admin/test/udump'

[oracle@sdb ~] $sqlplus / as sysdba

SQL > startup nomount pfile='/home/oracle/inittest.ora'

[oracle@sdb ~] $cd / u01/app/oracle/oradata/test/

The following is the key point. Be sure to copy the control file to the appropriate directory after recovery.

[oracle@sdb test] $cp. / control* / u03/oradata/test/

[oracle@sdb test] $sqlplus / as sysdba

SQL > alter database mount

SQL > alter database open

SQL > create spfile from pfile

Create spfile from pfile

ERROR at line 1:

ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file

'/ u01 apprenticeship oracle.ora'

The reason for the above error is that the pfile file was not found in the $ORACLE_HOME/dbs directory. Copy it to the / home/oracle/inittest.ora file before executing it.

SQL > create spfile from pfile

C. Modify temp file:

First take the data file offline, then change the name and path, and finally make the data file online

SQL > alter database tempfile'/ u01 offline

SQL > host cp / u01/app/oracle/oradata/test/temp01.dbf / u03/oradata/test/temp01.dbf

SQL > alter database rename file'/ u01qqappActionoradataUniverse temp01.dbf'to'/ u03oradataUniplicateoradataUniplicationoradataUniplicationoradataUniplestemp01.dbf'

SQL > alter database tempfile'/ u03max oradata online TestUniverse temp01.dbf'

5) check the overall situation of the recovery, and of course, you can also restore the archive.

SQL > shutdown immediate

SQL > startup

SQL > select name from v$datafile

SQL > select group#,member from v$logfile

SQL > select name from v$controlfile

This is the end of the content of "how to use RMAN to recover the entire database". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report