一、oracle 10g/11g
db_recovery_file_dest='/u01/app/oracle/flash_recovery_area';
1.sqlplus / as sysdba;登陆进去;
2、关闭数据库
SQL> shutdown immediate
Database closed. Database dismounted. ORACLE instance shut down.3、启动数据mount状态:
SQL> startup mount;
ORACLE instance started.Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes Variable Size 92276304 bytes Database Buffers 188743680 bytes Redo Buffers 2973696 bytes Database mounted.4、修改数据库为归档模式:
SQL> alter database archivelog;(非归档模式为noarchivelog)
Database altered.
5、打开数据库,查询:
SQL> alter database open;
Database altered.
SQL> archive log list
Database log mode Archive Mode Automatic archival Enabled Archive destination /oracle/oracle10g/log/archive_log Oldest online log sequence 0 Next log sequence to archive 1 Current log sequence 15、修改日志文件命名格式:
SQL> alter system set log_archive_max_processes = 5;
SQL> alter system set log_archive_format = "archive_%t_%s_%r.log" scope=spfile;System altered.
6、设置默认的归档路径:
查看 db_recovery_file_dest 参数设置,运行 show parameter db_recovery_file_dest 命令运行结果如下;
show parameter db_recovery_file_dest NAME TYPE VALUE----------------------------------- ----------- ------------------------------db_recovery_file_dest string e:\oracle\product\10.2.0\db_1\flash_recovery_area db_recovery_file_dest_size big integer 2G可以看到已经默认设置了归档的路径。
db_recovery_file_dest是缺省的归档位置,下面把它设置为"空",然后设置log_archive_dest参数,指定另外一个非缺省的参数
alter system set db_recovery_file_dest ='' scope = spfile;
重启db
运行 shutdown immediate;运行 startup mount;
运行 alter database open;
运行 show parameter db_recovery_file_dest 查看是否已经设置为空
alter system set log_archive_dest='xxxxxx' scope = spfile 设置归档日志文件路径;