oracle 9i\10gr1\10gr2归档模式切换

前端之家收集整理的这篇文章主要介绍了oracle 9i\10gr1\10gr2归档模式切换前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Single Instance

Oracle 9i

On a single node 9i instance the archive log mode is reset as follows.

ALTER SYSTEM SET log_archive_start=TRUE SCOPE=spfile;
ALTER SYSTEM SET log_archive_dest_1='location=/u01/oradata/MYSID/archive/' SCOPE=spfile;
ALTER SYSTEM SET log_archive_format='arch_%t_%s.arc' SCOPE=spfile;

SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ARCHIVE LOG START;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
Oracle 10g Upward

In Oracle 10g theLOG_ARCHIVE_STARTparameter andARCHIVE LOG STARTcommand have been deprecated,so you will use the following code.

ALTER SYSTEM SET log_archive_dest_1='location=/u01/oradata/MYSID/archive/' SCOPE=spfile;
ALTER SYSTEM SET log_archive_format='arch_%t_%s_%r.arc' SCOPE=spfile;

SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;

Real Application Clusters (RAC)

TheALTER DATABASE ARCHIVELOGcommand can only be performed if the database in mounted in exclusive mode. This means the whole clustered database must be stopped before the operation can be performed.

First we set the relevant archive parameters.

ALTER SYSTEM SET log_archive_start=TRUE SCOPE=spfile;
ALTER SYSTEM SET log_archive_dest_1='location=/u01/oradata/MYDB/archive/' SCOPE=spfile;
ALTER SYSTEM SET log_archive_format='arch_%t_%s.arc' SCOPE=spfile;

Since we need to mount the database in exclusive mode we must also alter the following parameter.

ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile;

From the command line we can stop the entire clustered database using the following.

$ srvctl stop database -d MYDB

With the cluster down we can connect to a single node and issue the following commands.

STARTUP MOUNT;
ARCHIVE LOG START;
ALTER DATABASE ARCHIVELOG;
ALTER SYSTEM SET cluster_database=TRUE SCOPE=spfile;
SHUTDOWN IMMEDIATE;

Notice that theCLUSTER_DATABASEparameter has been reset to it's original value. Since the datafiles and spfile are shared between all instances this operation only has to be done from a single node.

From the command line we can now start the clustered database again using the following.

$ srvctl start database -d MYDB

The current settings place all archive logs in the same directory. This is acceptable since the thread (%t) is part of the archive format preventing any name conflicts between instances. If node-specific locations are required theLOG_ARCHIVE_DEST_1parameter can be repeated for each instance with the relevant SID prefix.

Oracle 10gR1

If theLOG_ARCHIVE_DEST_nparameters are not set,the archived redo logs will be placed in the FRA. If you want to specify their location and the file name format manually,you can do it as follows.

ALTER SYSTEM SET log_archive_dest_1='location=/u01/oradata/MYDB/archive/' SCOPE=spfile;
ALTER SYSTEM SET log_archive_format='arch_%t_%s_%r.arc' SCOPE=spfile;

STARTUP MOUNT; ALTER DATABASE ARCHIVELOG; ALTER SYSTEM SET cluster_database=TRUE SCOPE=spfile; SHUTDOWN IMMEDIATE;

$ srvctl start database -d MYDB Oracle 10gR2

From 10gR2,you no longer need to reset theCLUSTER_DATABASEparameter during the process.

From the command line we can stop the entire clustered database and start it in mount mode using the following.

$ srvctl stop database -d MYDB
$ srvctl start database -d MYDB -o mount

With the database mounted issue the following commands.

sqlplus / as sysdba

ALTER DATABASE ARCHIVELOG;
EXIT;

Since the datafiles and spfile are shared between all instances this operation only has to be done from a single node.

From the command line we stop and start the clustered database again using the following commands.

$ srvctl stop database -d MYDB
$ srvctl start database -d MYDB

猜你在找的Oracle相关文章