oracle设置归档模式完整步骤
简要:
setp1 shutdown
setp2 startup mount
setp3 alter databse archivelog; 启用归档模式,关闭归档模式:alter databse noarchivelog;
setp4 alter system archive log start; 启动自动存档[archive log start/alter system archive log all]
setp5 alter database open;
[root@ems ~]# su - oracle
[oracle@ems ~]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.8.0 - Production on Sat Jun 14 17:43:32 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> host mv /soft/ora9/product/9.2/dbs/initoracle.ora /soft/ora9/product/9.2/dbs/initoracle.ora.bak
SQL> create pfile from spfile;
SQL> host echo "*.log_archive_start=/soft/ora9/oradata/archive">>/soft/ora9/product/9.2/dbs/initoracle.ora
#当然也可以使用来设立自动启动
#SQL>alter system set log_archive_start=true scope=spfile;
#System altered.
SQL> host echo "*.log_archive_dest='/soft/ora9/oradata/archive'">>/soft/ora9/product/9.2/dbs/initoracle.ora
#当然也可以使用来设立log目录
#SQL> ALTER SYSTEM SET log_archive_dest='/soft/ora9/oradata/archive';
#System altered.
SQL> host mkdir -p /soft/ora9/oradata/archive
SQL> host ls -la /soft/ora9/oradata/archive
total 8
drwxr-xr-x 2 oracle oinstall 4096 Jun 14 18:34 .
drwxr-xr-x 4 oracle oinstall 4096 Jun 14 17:41 ..
SQL> host cat /soft/ora9/product/9.2/dbs/initoracle.ora
*.background_dump_dest='/soft/ora9/admin/oracle/bdump'
*.compatible='9.2.0.0.0'
*.control_files='/soft/ora9/oradata/oracle/control01.ctl','/soft/ora9/oradata/oracle/control02.ctl','/soft/ora9/oradata/oracl
e/control03.ctl'
---------------------------
*.log_archive_dest='/soft/ora9/oradata/archive'
*.log_archive_start=TRUE
----------------------------
SQL> shutdown immediate;
SQL> startup mount pfile='/soft/ora9/product/9.2/dbs/initoracle.ora'
ORACLE instance started.
Total System Global Area 1024529740 bytes
Fixed Size 451916 bytes
Variable Size 486539264 bytes
Database Buffers 536870912 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Disabled
Archive destination /soft/ora9/oradata/oracle/archive
Oldest online log sequence 47
Next log sequence to archive 49
Current log sequence 49
SQL> host mv /soft/ora9/product/9.2/dbs/spfileoracle.ora /soft/ora9/product/9.2/dbs/spfileoracle.ora.bak
SQL> create spfile from pfile;
SQL> shutdown immediate;
Database closed.
Database dismounted.
startupORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1024529740 bytes
Fixed Size 451916 bytes
Variable Size 486539264 bytes
Database Buffers 536870912 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /soft/ora9/oradata/archive
Oldest online log sequence 47
Next log sequence to archive 49
Current log sequence 49
SQL> alter system switch logfile;
System altered.
SQL> host ls -la /soft/ora9/oradata/archive
total 1080
drwxr-xr-x 2 oracle oinstall 4096 Jun 14 17:48 .
drwxr-xr-x 4 oracle oinstall 4096 Jun 14 17:41 ..
-rw-r----- 1 oracle oinstall 1092608 Jun 14 17:48 1_49.dbf