</div>
<div>
<br>3.环境准备
</div>
<div>
3.1 设定初始化参数
<br> 使用pfile的修改init.ora文件,使用spfile的通过alter system命令修改spile文件。主、从数据库分别执行如下的语句:
</div>
<div>
Sqlplus ‘/ as sysdba’
<br> alter system set aq_tm_processes=2 scope=both;
<br> alter system set global_names=true scope=both;
<br> alter system set job_queue_processes=10 scope=both;
<br> alter system set parallel_max_servers=20 scope=both;
<br> alter system set undo_retention=3600 scope=both;
<br> alter system set nls_date_format='YYYY-MM-DD HH24:MI:SS' scope=spfile;
<br> alter system set streams_pool_size=25M scope=spfile;
<br> alter system set utl_file_dir='*' scope=spfile;
<br> alter system set open_links=4 scope=spfile;
<br>注:以上参数设置,关于数量设置的部分,若默认值大于需要修改的值,则不用调整
</div>
<div>
SQL> alter system set aq_tm_processes=2 scope=both;
</div>
<div>
SQL> alter system set global_names=true scope=both;
</div>
<div>
SQL> alter system set undo_retention=3600 scope=both;
</div>
<div>
SQL> alter system set nls_date_format='YYYY-MM-DD HH24:MI:SS' scope=spfile;
</div>
<div>
SQL> alter system set streams_pool_size=25m scope=spfile;
</div>
<div>
SQL> alter system set utl_file_dir='*' scope=spfile;
</div>
<div>
执行完毕后重启数据库
</div>
<div>
SQL> shut immediate;
<br>SQL> startup
</div>
<div>
3.2 将数据库置为归档模式
</div>
<div>
设置log_archive_dest_1到相应的位置;设定log_archive_start为TRUE,即启用自动归档功能;设定log_archive_format指定归档日志的命令格式。
<br> sqlplus ‘/ as sysdba’
<br> alter system set log_archive_dest_1='LOCATION=/data/szxddb/archivefile/' scope=spfile;
<br> alter system set log_archive_start=TRUE scope=spfile; --该参数在Oracle 11g已不适用,不用调整
<br> alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
<br> shutdown immediate;
<br> startup mount;
<br> alter database archivelog;
<br> alter database open;
</div>
<div>
SQL> alter system set log_archive_dest_1='LOCATION=/data/szxddb/archivefile/' scope=spfile;
</div>
<div>
SQL> alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
</div>
<div>
SQL> shut immediate;
</div>
<div>
SQL> startup mount;
</div>
<div>
SQL> alter database archivelog;
</div>
<div>
SQL> alter database open;
</div>
<div>
数据库置为归档模式后,可以按如下方式检验一下:
<br>SQL> archive log