ITPub博客

首页 > 数据库 > Oracle > 手动建库过程错误

手动建库过程错误

原创 Oracle 作者:skyin_1603 时间:2016-10-14 00:19:40 0 删除 编辑
模拟手动建库的过程,往往在中间创建参数文件的过程容易出错,
最容易出错的地方是审计目录的设置,容易被忽略,其次就是控制文件目录
的设置,往往在启动实例的时候报错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博客 ” ,链接:https://blog.itpub.net/31392094/viewspace-2126306/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-09-06

  • 博文量
    231
  • 访问量
    215133