Oracle:增加控制文件(SPFILE)
如题所示,本文呈现增加控制文件的技术细节。
1.修改数据库参数:CONTROL_FILES。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
[oracle@ora12c dbs]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sun Nov 9 13:52:31 2014 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics and Real Application Testing options SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ atlas OPEN SQL> show parameter control_files; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_files string /oradata/ATLAS/controlfile/o1_ mf_b5cyjq6b_.ctl, /oradata/fas t_recovery_area/ATLAS/controlf ile/o1_mf_b5cyjqjb_.ctl SQL> SQL> alter system set control_files='/oradata/ATLAS/controlfile/o1_mf_b5cyjq6b_.ctl','/oradata/fast_recovery_area/ATLAS/controlfile/o1_mf_b5cyjqjb_.ctl','/oradata/ATLAS/controlfile/atlas_controlfile_01.ctl'; alter system set control_files='/oradata/ATLAS/controlfile/o1_mf_b5cyjq6b_.ctl','/oradata/fast_recovery_area/ATLAS/controlfile/o1_mf_b5cyjqjb_.ctl','/oradata/ATLAS/controlfile/atlas_controlfile_01.ctl' * ERROR at line 1: ORA-02095: specified initialization parameter cannot be modified SQL> alter system set control_files='/oradata/ATLAS/controlfile/o1_mf_b5cyjq6b_.ctl','/oradata/fast_recovery_area/ATLAS/controlfile/o1_mf_b5cyjqjb_.ctl','/oradata/ATLAS/controlfile/atlas_controlfile_01.ctl' scope=spfile; System altered. SQL> SQL> show parameter control_files; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_files string /oradata/ATLAS/controlfile/o1_ mf_b5cyjq6b_.ctl, /oradata/fas t_recovery_area/ATLAS/controlf ile/o1_mf_b5cyjqjb_.ctl SQL> |
如上所示,Control_files是初始化参数,必须重启数据库实例,方能生效。
上述修改中,我新的控制文件的路径为:’/oradata/ATLAS/controlfile/atlas_controlfile_01.ctl’。
2.关闭数据库:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ atlas OPEN SQL> !ps -ef | grep ora_ oracle 39387 1 0 13:01 ? 00:00:00 ora_pmon_atlas oracle 39389 1 0 13:01 ? 00:00:00 ora_psp0_atlas oracle 39391 1 2 13:01 ? 00:01:27 ora_vktm_atlas oracle 39395 1 0 13:01 ? 00:00:00 ora_gen0_atlas oracle 39397 1 0 13:01 ? 00:00:00 ora_mman_atlas oracle 39401 1 0 13:01 ? 00:00:00 ora_diag_atlas oracle 39403 1 0 13:01 ? 00:00:01 ora_dbrm_atlas oracle 39405 1 0 13:01 ? 00:00:02 ora_vkrm_atlas oracle 39407 1 0 13:01 ? 00:00:04 ora_dia0_atlas oracle 39409 1 0 13:01 ? 00:00:00 ora_dbw0_atlas oracle 39411 1 0 13:01 ? 00:00:00 ora_lgwr_atlas oracle 39413 1 0 13:01 ? 00:00:01 ora_ckpt_atlas oracle 39415 1 0 13:01 ? 00:00:00 ora_smon_atlas oracle 39417 1 0 13:01 ? 00:00:00 ora_reco_atlas oracle 39419 1 0 13:01 ? 00:00:00 ora_lreg_atlas oracle 39421 1 0 13:01 ? 00:00:00 ora_pxmn_atlas oracle 39423 1 0 13:01 ? 00:00:01 ora_mmon_atlas oracle 39425 1 0 13:01 ? 00:00:02 ora_mmnl_atlas oracle 39427 1 0 13:01 ? 00:00:00 ora_d000_atlas oracle 39429 1 0 13:01 ? 00:00:00 ora_s000_atlas oracle 39861 1 0 13:41 ? 00:00:00 ora_tmon_atlas oracle 39863 1 0 13:41 ? 00:00:00 ora_tt00_atlas oracle 39865 1 0 13:41 ? 00:00:00 ora_smco_atlas oracle 39867 1 0 13:41 ? 00:00:00 ora_w000_atlas oracle 39869 1 0 13:41 ? 00:00:00 ora_w001_atlas oracle 39871 1 0 13:41 ? 00:00:00 ora_aqpc_atlas oracle 39875 1 0 13:41 ? 00:00:00 ora_p000_atlas oracle 39877 1 0 13:41 ? 00:00:00 ora_p001_atlas oracle 39879 1 0 13:41 ? 00:00:00 ora_p002_atlas oracle 39881 1 0 13:41 ? 00:00:00 ora_p003_atlas oracle 39883 1 0 13:41 ? 00:00:00 ora_cjq0_atlas oracle 40046 1 0 13:41 ? 00:00:00 ora_qm02_atlas oracle 40052 1 0 13:41 ? 00:00:00 ora_q003_atlas oracle 40054 1 0 13:41 ? 00:00:00 ora_q004_atlas oracle 40181 40153 0 13:57 pts/2 00:00:00 /bin/bash -c ps -ef | grep ora_ oracle 40183 40181 0 13:57 pts/2 00:00:00 grep ora_ SQL> SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> exit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics and Real Application Testing options [oracle@ora12c dbs]$ ps -ef | grep ora_ oracle 40188 39474 0 13:57 pts/2 00:00:00 grep ora_ [oracle@ora12c dbs]$ |
3.复制当前的控制文件的副本到新路径:
1 2 3 4 5 6 7 8 9 10 11 12 |
[oracle@ora12c dbs]$ cd /oradata/ATLAS/controlfile/ [oracle@ora12c controlfile]$ pwd /oradata/ATLAS/controlfile [oracle@ora12c controlfile]$ ls -ltr total 17576 -rw-r----- 1 oracle oinstall 17973248 Nov 9 13:57 o1_mf_b5cyjq6b_.ctl [oracle@ora12c controlfile]$ cp -p o1_mf_b5cyjq6b_.ctl /oradata/ATLAS/controlfile/atlas_controlfile_01.ctl [oracle@ora12c controlfile]$ ls -ltr total 35152 -rw-r----- 1 oracle oinstall 17973248 Nov 9 13:57 o1_mf_b5cyjq6b_.ctl -rw-r----- 1 oracle oinstall 17973248 Nov 9 13:57 atlas_controlfile_01.ctl [oracle@ora12c controlfile]$ |
4.启动数据库实例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
[oracle@ora12c controlfile]$ ps -ef | grep ora_ oracle 40203 39474 0 14:00 pts/2 00:00:00 grep ora_ [oracle@ora12c controlfile]$ env | grep SID ORACLE_SID=atlas [oracle@ora12c controlfile]$ [oracle@ora12c controlfile]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sun Nov 9 14:00:38 2014 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 1140850688 bytes Fixed Size 2923584 bytes Variable Size 771752896 bytes Database Buffers 352321536 bytes Redo Buffers 13852672 bytes Database mounted. Database opened. SQL> !ps -ef | grep pmon oracle 40211 1 0 14:00 ? 00:00:00 ora_pmon_atlas oracle 40443 40206 0 14:00 pts/2 00:00:00 /bin/bash -c ps -ef | grep pmon oracle 40445 40443 0 14:00 pts/2 00:00:00 grep pmon SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ atlas OPEN SQL> |
5.查看当前的CONTROL_FILES状态:
1 2 3 4 5 6 7 8 9 10 11 |
SQL> show parameter control_files; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_files string /oradata/ATLAS/controlfile/o1_ mf_b5cyjq6b_.ctl, /oradata/fas t_recovery_area/ATLAS/controlf ile/o1_mf_b5cyjqjb_.ctl, /orad ata/ATLAS/controlfile/atlas_co ntrolfile_01.ctl SQL> |
至此,控制文件的新增,完成。
————————————————
Ending。
1 thought on “Oracle:增加控制文件(SPFILE)”