Oracle启用归档
1、单实例
Oracle 9i
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
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; |
2、Oracle RAC
Oracle 9i
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; # 禁用集群模式 ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile; # 停止数据库 srvctl stop database -d MYDB # 配置归档 STARTUP MOUNT; ARCHIVE LOG START; ALTER DATABASE ARCHIVELOG; ALTER SYSTEM SET cluster_database=TRUE SCOPE=spfile; SHUTDOWN IMMEDIATE; # 启动数据库 srvctl start database -d MYDB |
Oracle 10gR1
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; # 禁用集群模式 ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile; # 停止数据库 $ srvctl stop database -d MYDB # 配置归档 STARTUP MOUNT; ALTER DATABASE ARCHIVELOG; ALTER SYSTEM SET cluster_database=TRUE SCOPE=spfile; SHUTDOWN IMMEDIATE; # 启动数据库 $ srvctl start database -d MYDB |
Oracle 10gR2/11g/12c
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; # 启动到mount模式 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 |