手動建庫過程錯誤

skyin_1603發表於2016-10-14
模擬手動建庫的過程,往往在中間建立引數檔案的過程容易出錯,
最容易出錯的地方是審計目錄的設定,容易被忽略,其次就是控制檔案目錄
的設定,往往在啟動例項的時候報錯ORA-09925:。以下是模擬一些錯誤並糾正的過程。

1、確定例項名:
[oracle@enmo ~]$ export ORACLE_SID=PROD


[oracle@enmo ~]$ cd $ORACLE_HOME/dbs
[oracle@enmo dbs]$ 

[oracle@enmo dbs]$ ls
hc_OCMU.dat  initOCMU.ora  init.ora.bck  lkORA11GR2  orapwPROD      spfileOCMU.ora
hc_PROD.dat  init.ora      initPROD.ora  lkPROD      snapcf_OCMU.f  spfilePROD.ora
[oracle@enmo dbs]$ 

2、從spfile檔案建立pfile檔案:
[oracle@enmo dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 13 13:54:17 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.


3、開啟例項到nomount狀態:
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size                  2257840 bytes
Variable Size             541068368 bytes
Database Buffers          289406976 bytes
Redo Buffers                2371584 bytes
SQL> select status fron v$instance;
select status fron v$instance
                   *
SQL> select status from v$instance  ;

STATUS
------------
STARTED

這個狀態下,還沒有開啟spfile引數檔案:


4、建立引數pfile檔案:
SQL> create pfile from spfile;

File created.
檔案已經建立。

[oracle@enmo dbs]$ ls
hc_OCMU.dat  initOCMU.ora  init.ora.bck  lkORA11GR2  orapwPROD      spfileOCMU.ora
hc_PROD.dat  init.ora      initPROD.ora  lkPROD      snapcf_OCMU.f  spfilePROD.ora
[oracle@enmo dbs]$ 

5、修改pfile引數檔案並模擬設定audit_file_dest目錄錯誤情況:
修改前:
[oracle@enmo dbs]$ vi initPROD.ora
PROD.__db_cache_size=289406976
PROD.__java_pool_size=4194304
PROD.__large_pool_size=71303168
PROD.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
PROD.__pga_aggregate_target=335544320
PROD.__sga_target=503316480
PROD.__shared_io_pool_size=0
PROD.__shared_pool_size=130023424
PROD.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/prod/adump'
*.compatible='11.2.0'
*.control_files='/u01/app/oracle/oradata/PROD/ora_control1.ctl','/u01/app/oracle/oradata/PROD/ora_control2.ctl',
'/u01/app/oracle/fast_recovery_area/ora_control3.ctl','/u01/app/FRA/ora_control4.ctl'
*.db_block_size=8192
*.db_domain='oracle.com'
*.db_name='PROD'
*.db_recovery_file_dest_size=3221225472
*.db_recovery_file_dest='/u01/app/FRA/'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
*.memory_target=800M
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'

修改後:
[oracle@enmo dbs]$ vi initPROD.ora
PROD.__db_cache_size=289406976
PROD.__java_pool_size=4194304
PROD.__large_pool_size=71303168
PROD.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
PROD.__pga_aggregate_target=335544320
PROD.__sga_target=503316480
PROD.__shared_io_pool_size=0
PROD.__shared_pool_size=130023424
PROD.__streams_pool_size=0
*.audit_file_dest='<ORACLE_BASE>/admin/prod/adump'
*.compatible='11.2.0'
*.control_files='/u01/app/oracle/oradata/PROD/ora_control1.ctl','/u01/app/oracle/oradata/PROD/ora_control2.ctl',
'/u01/app/oracle/fast_recovery_area/ora_control3.ctl','/u01/app/FRA/ora_control4.ctl'
*.db_block_size=8192
*.db_domain='oracle.com'
*.db_name='PROD'
*.db_recovery_file_dest_size=3221225472
*.db_recovery_file_dest='/u01/app/FRA/'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
*.memory_target=800M
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'

6、生成spfile檔案:
SQL> create spfile from pfile;

File created.

7、開啟例項:
[oracle@enmo dbs]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 13 14:16:27 2016


Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount;
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9925
發現報錯,是由於Unable to create audit trail file系統沒有相應的目錄。


8、檢視系統層的目錄/路徑
[oracle@enmo prod]$ pwd
/u01/app/oracle/admin/prod
[oracle@enmo prod]$ cd adump
[oracle@enmo adump]$ 

9、去修改pfile檔案,重新生成spfile檔案:
[oracle@enmo dbs]$ vi initPROD.ora
PROD.__db_cache_size=289406976
PROD.__java_pool_size=4194304
PROD.__large_pool_size=71303168
PROD.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
PROD.__pga_aggregate_target=335544320
PROD.__sga_target=503316480
PROD.__shared_io_pool_size=0
PROD.__shared_pool_size=130023424
PROD.__streams_pool_size=0
*.audit_file_dest='<ORACLE_BASE>/admin/prod/adump'       ----糾正後
*.compatible='11.2.0'
... ...

10、從 pfile生成spfile
SQL> create spfile from pfile;

File created.

11、修改過後,啟動資料庫到nomount狀態:
SQL> startup nomount;
ORACLE instance started.


Total System Global Area  835104768 bytes
Fixed Size                  2257840 bytes
Variable Size             541068368 bytes
Database Buffers          289406976 bytes
Redo Buffers                2371584 bytes
SQL> 


12、到這裡,直接執行建庫指令碼。
由於我的已經建好,所以直接修改到mount狀態。
SQL> alter database mount;

Database altered.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2126306/,如需轉載,請註明出處,否則將追究法律責任。

相關文章