灌溉梦想,记录脚步
« »
2015 年 02 月 11 日技术合集

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

日志信息 »

该日志于2015-02-11 16:48由 kevin 发表在技术合集分类下, 你可以发表评论。除了可以将这个日志以保留源地址及作者的情况下引用到你的网站或博客,还可以通过RSS 2.0订阅这个日志的所有评论。

没有评论

发表评论 »