归档相关命令
archive log stop;
archive log start;
archive log list;
show parameters;
show parameters log_archive_start;
show parameters log_archive_max_process; #归档进程数
alter system set log_archive_max_process=5; #将归档进程数改为5
select * from v$bgprocess; #检察后台进程
***********************************************************************
查看oracle数据库是否为归档模式
idle> select name,log_mode from V$database;
NAME LOG_MODE
--------- ------------
ORCL ARCHIVELOG
idle> archive log list ;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /arch
Oldest online log sequence 6
Next log sequence to archive 8
Current log sequence 8
*********************************************************************************************
如果要启用归档模式,此处使用
alter database archivelog 命令。idle>alter database archivelog;Database altered.
idle> alter database open;
Database altered.
idle> archive log list;
Database log modeArchive ModeAutomatic archival EnabledArchive destination /opt/oracle/oradata/conner/archive
Oldest online log sequence 148
Next log sequence to archive 151
Current log sequence 151
*********************************************************************************************
启用自动归档
idle> alter system archive log start;
System altered.
*********************************************************************************************
如果需要停止归档模式,此处使用:alter database noarchivelog命令。
idle> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
idle> startup mount;
ORACLE instance started.
Total System Global Area 101782828 bytes
Fixed Size 451884 bytes
Variable Size 37748736 bytes
Database Buffers 62914560 bytes
Redo Buffers 667648 bytes
Database mounted.
idle> alter database open;
Database altered.
idle> archive log list;
Database log modeNo Archive ModeAutomatic archival Enabled
Archive destination /opt/oracle/oradata/conner/archive
Oldest online log sequence 149
Current log sequence 152
Oracle10g之前,你还需要修改初始化参数使数据库处于自动归档模式。
在pfile/spfile中设置如下参数:
log_archive_start = true
重启数据库此参数生效,此时数据库处于自动归档模式。
也可以在数据库启动过程中,手工执行:
archive log start
使数据库启用自动归档,但是重启后数据库仍然处于手工归档模式。
编辑本段配置数据库的归档模式
1.改变非归档模式到归档模式:
idle> conn / as sysdba (以DBA身份连接数据库)
idle> shutdown immediate;(立即关闭数据库)
idle> startup mount (启动实例并加载数据库,但不打开)
idle> alter database archivelog; (更改数据库为归档模式)
idle> alter database open; (打开数据库)
idle> alter system archive log start; (启用自动归档)
idle> exit (退出)