0

Objective: 在创建oracle数据库的时候配置audit_trail='db,extended'

环境:
CentOS7

场景:
Oracle11gXE(已安装二进制文件但未创建数据库)

初始化.ora:

db_name='xe'
memory_target='1024m'
processes='150'
sessions='20'
audit_file_dest='/u01/app/oracle/admin/xe/adump'
audit_trail='os'
#audit_trail='db,extended'
audit_sys_operations='true'
background_dump_dest='/u01/app/oracle/admin/xe/bdump'
core_dump_dest='/u01/app/oracle/admin/xe/cdump'
#data_pump_dir='/u01/app/oracle/admin/xe/dpdump'
user_dump_dest='/u01/app/oracle/admin/xe/udump'
db_block_size='8192'
db_domain=''
diagnostic_dest='/u01/app/oracle/product/11.2.0/xe/diag'
dispatchers='(protocol=tcp)(service=xe)'
shared_servers='4'
open_cursors='300'
remote_login_passwordfile='exclusive'
undo_management='auto'
undo_tablespace='xe_undo_tbs'
control_files=('/u01/app/oracle/oradata/11.2.0/xe/control_a/xe_a.ctl', '/u02/app/oracle/oradata/11.2.0/xe/control_b/xe_b.ctl', '/u03/app/oracle/oradata/11.2.0/xe/control_c/xe_c.ctl')
job_queue_processes='4'
db_recovery_file_dest_size='10g'
db_recovery_file_dest='/u01/app/oracle/oradata/11.2.0/xe/flash'
compatible='11.2.0'
log_archive_format='%r_%t_%s'
log_archive_dest_1='location=/u01/app/oracle/oradata/11.2.0/xe/archive1'
log_archive_dest_2='location=/u02/app/oracle/oradata/11.2.0/xe/archive2'
log_archive_dest_3='location=/u03/app/oracle/oradata/11.2.0/xe/archive3'
log_archive_dest_state_1='enable'
log_archive_dest_state_2='enable'
log_archive_dest_state_3='enable'

和 dbcreate.sql

Prompt ******  SHUTTING DOWN....
SHUTDOWN IMMEDIATE;
Prompt ******  STARTING UP IN NOMOUNT MODE ....
STARTUP NOMOUNT pfile='/u01/app/oracle/oradata/11.2.0/xe/pfile/init_xe.ora';

Prompt ******  EXECUTING, CREATE DATABASE  xe ....
CREATE DATABASE xe
USER sys IDENTIFIED BY xe2357
USER system  IDENTIFIED BY xe2357
logfile group 1 ('/u01/app/oracle/oradata/11.2.0/xe/log_grp_a/xe_log1a.log', '/u02/app/oracle/oradata/11.2.0/xe/log_grp_b/xe_log1b.log', '/u03/app/oracle/oradata/11.2.0/xe/log_grp_c/xe_log1c.log') size 100m,
group 2 ('/u01/app/oracle/oradata/11.2.0/xe/log_grp_a/xe_log2a.log', '/u02/app/oracle/oradata/11.2.0/xe/log_grp_b/xe_log2b.log', '/u03/app/oracle/oradata/11.2.0/xe/log_grp_c/xe_log2c.log') size 100m,
group 3 ('/u01/app/oracle/oradata/11.2.0/xe/log_grp_a/xe_log3a.log', '/u02/app/oracle/oradata/11.2.0/xe/log_grp_b/xe_log3b.log', '/u03/app/oracle/oradata/11.2.0/xe/log_grp_c/xe_log3c.log') size 100m
maxlogfiles 32
maxlogmembers 4
maxloghistory 100
maxdatafiles 254
character set US7ASCII
national character set AL16UTF16
extent management local
datafile '/u01/app/oracle/oradata/11.2.0/xe/system/xe_system.dbf' size 325m reuse
sysaux datafile '/u01/app/oracle/oradata/11.2.0/xe/sysaux/xe_sys_aux.dbf' size 325m reuse
default tablespace xe_default_tbs
datafile '/u01/app/oracle/oradata/11.2.0/xe/default/xe_default.dbf'
SIZE 500M AUTOEXTEND ON MAXSIZE UNLIMITED
default temporary tablespace xe_temp_tbs
tempfile '/u01/app/oracle/oradata/11.2.0/xe/temp/xe_temp.dbf'
size 20m reuse
undo tablespace xe_undo_tbs
datafile '/u01/app/oracle/oradata/11.2.0/xe/undo/xe_undo.dbf'
size 200m reuse autoextend on maxsize unlimited;

Prompt ******  EXECUTING, SELECT INSTANCE_NAME, DATABASE_STATUS....
SELECT INSTANCE_NAME, DATABASE_STATUS, INSTANCE_ROLE FROM v$instance;
Prompt ******  SHUTTING DOWN....
SHUTDONW;
Prompt ******  EXITING SQLPLUS....
EXIT;
Prompt ******  CREATED DATABASE....

如果设置,脚本会正确创建数据库,audit_trail='os'但如果设置则会引发错误 audit_trail='db,extended'

错误日志:

LRM-00121: 'db,extended' is not an allowable value for 'audit_trail'
ORA-01078: failure in processing system parameters

以后是否可以改?如果这样做,会有什么问题吗?

请指导我在创建数据库时通过 init.ora 中的 audit_trail='db,extended' 脚本创建数据库。

4

1 回答 1

1

删除 'db,extended' 周围的引号

oracle:oklacity$ grep audit_trail initoklacity.ora
*.audit_trail='db,extended'

oracle:oklacity$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 21 16:39:23 2020

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00121: 'db,extended' is not an allowable value for 'audit_trail'
SQL> 

不带引号

oracle:oklacity$ grep audit_trail initoklacity.ora
*.audit_trail=db,extended

oracle:oklacity$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 21 16:41:06 2020

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  726540288 bytes
Fixed Size          2216904 bytes
Variable Size         549456952 bytes
Database Buffers      167772160 bytes
Redo Buffers            7094272 bytes
Database mounted.
Database opened.
于 2020-02-21T22:42:13.930 回答