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_START
parameter andARCHIVE LOG START
command 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 ARCHIVELOG
command 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.
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_DATABASE
parameter 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_1
parameter can be repeated for each instance with the relevant SID prefix.
If theLOG_ARCHIVE_DEST_n
parameters 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 the From the command line we can stop the entire clustered database and start it in mount mode using the following. With the database mounted issue the following commands. 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.CLUSTER_DATABASE
parameter during the process.$ srvctl stop database -d MYDB
$ srvctl start database -d MYDB -o mount
sqlplus / as sysdba
ALTER DATABASE ARCHIVELOG;
EXIT;
$ srvctl stop database -d MYDB
$ srvctl start database -d MYDB
原文链接:https://www.f2er.com/oracle/211863.html