How to configure audit_trail='db,extended' at the time of oracle database creation? - oracle

Objective: to configure audit_trail='db,extended' at the time of oracle database creation
Environment:
CentOS7
Scenario:
Oracle11gXE (binaries installed but not database created)
init.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'
and 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....
Script creates database properly, if set audit_trail='os' but it throws error if set audit_trail='db,extended'.
Error Log:
LRM-00121: 'db,extended' is not an allowable value for 'audit_trail'
ORA-01078: failure in processing system parameters
whether later it can be changed? will there be any issues, if doing so?
Please guide me in creating database through script with audit_trail='db,extended' in init.ora at the time of db creation.

Remove the quotes from around '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>
without quotes
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.

Related

I am getting ORA-04043: object does not exist error in SQL loader. When command is being executed getting table does not exist error

CSV FILE CONTENT
portal,,
ex portal,,
,,
i_id,i_name,risk
1,a,aa
2,b,bb
3,c,cc
4,d,dd
5,e,ee
6,f,ff
7,g,gg
8,h,hh
9,i,ii
10,j,jj
CONTROL FILE CONTENT
options (
skip=4,
PARALLEL=true,
DIRECT=true
)
LOAD DATA
INFILE 'E:\sqlloader\testfile.csv'
APPEND
INTO TABLE LOADER_TAB
FIELDS TERMINATED BY ","
(
i_id,
i_name,
risk
)
I am getting object does not exist but table name does exist in the schema system
select tab.owner, tab.STATUS
from dba_tables tab
where tab.TABLE_NAME = 'LOADER_TAB';
Also tried by giving scema_name.table_name but no luck.
options (
skip=4,
PARALLEL=true,
DIRECT=true
)
LOAD DATA
INFILE 'E:\sqlloader\testfile.csv'
APPEND
INTO TABLE SYSTEM.LOADER_TAB
FIELDS TERMINATED BY ","
(
i_id,
i_name,
risk
)
Can someone help me on this I had searched for the answer and did all possible way but not getting the solution.
You're almost there - here's a top to bottom run of the code, the only change being I've created a schema to hold the table and the path names for the CSV file. So follow the demo below and if yours does not get the same result, edit the question with the full output similar to below. Also, if you still get issues, try it without DIRECT/PARALLEL which will help us dig deeper into the "why".
SQL> create user myuser identified by mypassword;
User created.
SQL> alter user myuser quota unlimited on users;
User altered.
SQL> grant connect, resource to myuser;
Grant succeeded.
SQL> create table myuser.LOADER_TAB(i_id number(10),i_name varchar2(30),risk varchar2(30));
Table created.
x:\tmp>sqlldr userid=myuser/mypassword#db19_pdb1 control=loader.ctl
SQL*Loader: Release 19.0.0.0.0 - Production on Tue Nov 2 11:38:58 2021
Version 19.12.0.0.0
Copyright (c) 1982, 2021, Oracle and/or its affiliates. All rights reserved.
Path used: Direct
Load completed - logical record count 10.
Table LOADER_TAB:
10 Rows successfully loaded.
Check the log file:
loader.log
for more information about the load.
x:\tmp>sqlplus myuser/mypassword#db19_pdb1
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 2 11:39:21 2021
Version 19.12.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Last Successful login time: Tue Nov 02 2021 11:38:58 +08:00
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.12.0.0.0
SQL> select * from loader_tab;
I_ID I_NAME RISK
---------- ------------------------------ ------------------------------
1 a aa
2 b bb
3 c cc
4 d dd
5 e ee
6 f ff
7 g gg
8 h hh
9 i ii
10 j jj
10 rows selected.

Error ORA-00210 while starting database Oracle?

While starting up oracle using following command i get following error:
SQL> startup
ORACLE instance started.
Total System Global Area 288141312 bytes
Fixed Size 2252504 bytes
Variable Size 230687016 bytes
Database Buffers 50331648 bytes
Redo Buffers 4870144 bytes
ORA-00205: error in identifying control file, check alert log for more info
When i check alert logs, i see following message:
Wed Nov 02 05:45:35 2016
ALTER DATABASE MOUNT
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/optware/oracle/11.2.0.4/db_1/dbs/<sid>_control2'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/optware/oracle/11.2.0.4/db_1/dbs/<sid>_control1'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
However when i check list of control files, i see location but dont know why file for control were not created:
SQL> show parameter CONTROL_FILES
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /optware/oracle/11.2.0.4/db_1/
dbs/<sid>_control1, /optwar
e/oracle/11.2.0.4/db_1/dbs/<sid>_control2
DB Creation script:
CREATE DATABASE "mydb"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/optware/oradata/mydb/system.dbf' SIZE 1024M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/optware/oradata/mydb/sysaux.dbf' SIZE 1024M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/optware/oradata/mydb/temp.dbf' SIZE 1500M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE "UNDOTB_mydb" DATAFILE '/optware/oradata/mydb/undotbs2.dbf' SIZE 500M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET UTF8
LOGFILE GROUP 1 ('/optware/oradata/mydb/redo1_a1.rdo', '/optware/oradata/mydb/redo1_b1.rdo') SIZE 20M,
GROUP 2 ('/optware/oradata/mydb/redo1_a2.rdo', '/optware/oradata/mydb/redo1_b2.rdo') SIZE 20M,
GROUP 3 ('/optware/oradata/mydb/redo1_a3.rdo', '/optware/oradata/mydb/redo1_b3.rdo') SIZE 20M
USER SYS IDENTIFIED BY "Welcome3" USER SYSTEM IDENTIFIED BY "Welcome3";
Please help
Besides the OP's solution (he had some extra whitespace in the wrong place in the init.ora file), I encountered the exact same errors about controlfiles when I attempted to set a "hidden" parameter_disable_highres_ticks to an apparently invalid value.

Oracle 10g: Error when creating database manually by scripts

My situation is that I have to create a new Oracle database using only scripts (so please do not advice me using DBCA)
My script is as below:
CreateDB.bat
set ORACLE_SID=testdb
oradim -new -sid %ORACLE_SID% -intpwd test -startmode M
copy init.ora D:\oracle\product\10.2.0\db_1\database\inittestdb.ora
sqlplus sys/test as sysdba #D:\Script\CreateDB.sql
==> "init.ora" is the file I copy from the DB created using DBCA
CreateDB.sql
CREATE SPFILE='D:\oracle\product\10.2.0\db_1\dbs\spfiletestdb.ora' FROM
PFILE='D:\oracle\product\10.2.0\db_1\database\inittestdb.ora';
startup nomount PFILE='D:\oracle\product\10.2.0\db_1\database\inittestdb.ora';
create database testdb
logfile group 1 ('D:\oracle\product\10.2.0\oradata\testdb\redo1.log') size 100M,
group 2 ('D:\oracle\product\10.2.0\oradata\testdb\redo2.log') size 100M,
group 3 ('D:\oracle\product\10.2.0\oradata\testdb\redo3.log') size 100M
character set JA16SJIS
national character set AL16UTF16
datafile 'D:\oracle\product\10.2.0\oradata\testdb\system01.dbf'
size 500M
autoextend on
next 100M maxsize unlimited
extent management local
sysaux datafile 'D:\oracle\product\10.2.0\oradata\testdb\sysaux01.dbf'
size 100M
autoextend on
next 100M
maxsize unlimited
DEFAULT TABLESPACE tbs_1
DATAFILE 'D:\oracle\product\10.2.0\oradata\testdb\tbs01.dbf'
SIZE 200M REUSE
DEFAULT temporary TABLESPACE tempts1
tempfile 'D:\oracle\product\10.2.0\oradata\testdb\temp01.dbf'
SIZE 200M REUSE
undo tablespace undotbs
datafile 'D:\oracle\product\10.2.0\oradata\testdb\undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
The above return error [ORA-30012: undo tablespace 'UNDOTBS01.DBF' does not exist or of wrong type].
At first, as i check the init.ora file, I found out that the parameter for UNTO tablespace have different name for UNDO file, so I change it to match the file name in my script.
Old:
undo_management=AUTO
undo_tablespace=UNDOTBS1.DBF
New:
undo_management=AUTO
undo_tablespace=UNDOTBS01.DBF
and delete the database (yes, even when error, the database is still created, just cannot be used) and re-run everthing again, and same error occurs.
I have research for 2 days and still cannot find any solution.
All the script above is following the guide on Oracle website:
http://docs.oracle.com/cd/B19306_01/server.102/b14231/create.htm
The OS is Windows Server 2003.
Database is Oracle 10g Standard Edition.
UPDATED 1:
Thank Mat, UNDO tablespace problem is solved :D
Now, next error pop-up.
Completed: ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMPTS1
Wed May 21 09:11:38 2014
Errors in file d:\oracle\product\10.2.0\admin\testdb\udump\testdb_ora_3416.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-02236: invalid file name
However, it is actually due to the missing of datafile option for [DEFAULT TABLESPACE tbs_1].
I have update the CREATE script above.
UPDATED 2:
A new problem occurred when I create a user for this database.
I have created a new topic for it on this link:
Oracle 10g: ORA-12154 when connect to database with newly created user
Any help will be appreciated.
The undo_tablespace parameter takes the name of the tablespace, not of the datafile.
You should have
undo_tablespace=UNDOTBS
in your parameter file to match your database creation script.

Oracle SQL*Loader timestamp is error

My control file is
ACCESS_TIME TERMINATED BY "" "TO_TIMESTAMP_TZ(:ACCESS_TIME,'YYYY/MM/DD HH24:MI:SS:FF TZR')"
Data file is
2012/11/12 15:18:00:765 CST
But when I run SQL*Loader to commit the data, in the database ACCESS_TIME does not match data file.
2012/11/13 05:18:00:765000000
if you're seeing that behaviour then the table column must be time stamp with local time zone and you are in Singapore etc (gmt +8) eg:
SQL> alter session set time_zone='+08:00';
Session altered.
SQL> create table test (access_time timestamp with local time zone);
Table created.
SQL> host sqlldr test/test control=/tmp/load.ctl log=/tmp/load.log
SQL*Loader: Release 11.2.0.1.0 - Production on Mon Nov 12 13:26:14 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 2
SQL> select * from test;
ACCESS_TIME
---------------------------------------------------------------------------
13-NOV-12 05.18.00.765000
SQL> alter session set time_zone='-06:00';
Session altered.
SQL> select * from test;
ACCESS_TIME
---------------------------------------------------------------------------
12-NOV-12 15.18.00.765000
SQL> host cat /tmp/load.ctl
load data
infile *
replace
into table test
( ACCESS_TIME terminated by "" "TO_TIMESTAMP_TZ(:ACCESS_TIME,'YYYY/MM/DD HH24:MI:SS:FF TZR')"
)
begindata
2012/11/12 15:18:00:765 CST
if you want to preserve the CST part and not convert it then define your table as TIMESTAMP WITH TIME ZONE.
SQL> create table test (access_time timestamp with time zone);
Table created.
SQL> host sqlldr test/test control=/tmp/load.ctl log=/tmp/load.log
SQL*Loader: Release 11.2.0.1.0 - Production on Mon Nov 12 13:27:56 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 2
SQL> select * from test;
ACCESS_TIME
---------------------------------------------------------------------------
12-NOV-12 15.18.00.765000 CST
Do a:
select SESSIONTIMEZONE from dual;
You insert your data in Central Standard Time. When you select the data it is probably displayed in your sessions (local) timezone.

tnslistener does not currently know of sid given in connect descriptor oracle11g after database successfully created

I've created a database in oracle 11g with the following commands:
oradim -NEW -SID TA -STARTMODE auto
sqlplus /as sysdba /nolog #CreateDatabase.sql
conn / as sysdba
CREATE SPFILE='C:/Databases/Tamiflu/tamifludb.ora' FROM PFILE='C:/Databases/Tamiflu/inittamiflu.ora';
SHUTDOWN
startup nomount pfile="C:/Databases/Tamiflu/inittamiflu.ora';
CREATE DATABASE db name
USER SYS IDENTIFIED BY EuroRSCG1
USER SYSTEM IDENTIFIED BY EuroRSCG1
LOGFILE GROUP 1 ('C:/Databases/Tamiflu/Logs/redo01.log') SIZE 100M,
GROUP 2 ('C:/Databases/Tamiflu/Logs/redo02.log') SIZE 100M,
GROUP 3 ('C:/Databases/Tamiflu/Logs/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
DATAFILE 'C:/Databases/Tamiflu/Data/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE 'C:/Databases/Tamiflu/Data/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE tbs_1
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE 'C:/Databases/Tamiflu/Data/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE 'C:/Databases/Tamiflu/Data/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
It successfully executes.
Then when I try to view the DB in SQL Developer, it says it doesn't know the SID. But I established the SID earlier.
I don't know how to clear oracle's SID cache or. What to do now.
A few things don't add up here
The instance is named ta
The database init.ora file is named tamiflu
The create database statement is not correct. what is the database name ? db_name?
All of these values should be consistent.

Resources