Log 'alter system ' commands
Hi
I am looking for a way to track alter system / alter database commands.
Database triggers are not logging them : I do have a database trigger for DDLs tracking that works great but alter system commands are not captured by it . also trigger 'alter alter on database ' - do not log alter system or alter database
Is there a way for me to force a command to appear in the alert log ?
Or any other way you can think of ?
thanks
Orna
Orna,
YOu can create a database level trigger to capture ALTER statement and insert them into a user defined table. This is just one example you can define trigger at schema level as well.
CREATE OR REPLACE TRIGGER usiuser.myaltertrg
BEFORE ALTER
ON DATABASE
DECLARE
tmpvar NUMBER;
BEGIN
tmpvar := 0;
-- your code to insert alter statement in user defined table.
EXCEPTION
WHEN OTHERS
THEN
-- Consider logging the error and then re-raise
RAISE;
END myaltertrg;Regards
Edited by: OrionNet on Dec 29, 2008 1:30 PM
Similar Messages
-
Hi all,
I am just bit confused in the following two commands
SQL> ALTER SYSTEM SWITCH LOGFILE;
SQL> ALTER SYSTEM CHECKPOINT;
So what is the main difference between the first and second cmds?
Why seniors/books suggest to use first command instead of the second one ?372211, if you run manual hot backups then at the conclusion of copying the files for the last tablespace in your hot backup and issueing the "end backup" command you generally issue the ALTER SYSTEM SWITCH LOGFILE command to force all redo necessary to bring the backups to a consistent point in time during forward recovery.
The archived redo logs and backup copies just made can be duplicated for sending off-site and provide a consistet image in the event of a diaster that results in the loss of archieved redo logs made after the backup.
Also, to add to what was said about checkpoints - The header blocks for the database files must also be updated with the checkpoint information.
HTH -- Mark D Powell -- -
Need help on submitting ALTER SYSTEM command.
I have a report of a list of active xml threads from our EM repository, which is pulled from 4 RAC instances. I have a region with this statement:
select a.inst_id, a.sid,a.serial#,b.instance_name, b.host_name, a.machine, a.status
from gv$session@emrepo a, gv$instance@emrepo b
where a.action like 'XML%'
and a.inst_id = b.instance_number
order by a.inst_id
The result shows me what I want. Now I want to be able to select the XML threads that I want to kill with the alter system kill command such as:
alter system kill session 'sid, serial#'; (where sid and serial# is pulled from above).
Question is how can I do this, plus need to figure out to make sure I am running this against the right RAC instance. Any help is appreciated. Thanks.
VictorYou can link to a confirmation page and set 2 items on that page SID and SERIAL# through the URL. Then create a process on the 2nd page that fires "On Submit" with the following code:execute immediate 'alter system disconnect session '||''''||:P2_SID||','||:P2_SERIAL||''' immediate';Create a button on the 2nd page to submit the page (fire your process when request = the button request).
As far as how this works with RAC, you're on your own on that one ;)
Thanks,
Tyler -
COMMENTS in ALTER SYSTEM command
I ran the query
SQL>ALTER SYSTEM SET sga_target=216M COMMENT='Test';
which view/table will describe the changes of sga_target and corresponding comment.
I searched in v$system_parameter and v$parameter, but the value did not get updated.I did query on V$PARAMETER, V$SYSTEM_PARAMETER, V$SYSTEM_PARAMETER2 and found that the value of sga_target (148M) is updated in all the views, whereas the comment attribute is updated only in V$PARAMETER view. Also I disconnected from SQL Plus and logged in again (new session), the comment attribute has been reset to old value. As long as the value is updated in all the views, the comment attribute should also be updated in all the views.
-
Can I do "alter system" commands thru JDBC
I have a small java program that occasionally needs to kill sessions. Can I do this through JDBC? My code is not erroring out but it is also not killing the session. I'm pretty sure I'm using the correct sid and serial# but I'll check again. And, yes, the user logged on has the appropriate privileges.
TIA
- WillThe answer is yes you can do it (and you should hesitate on posting things until you are really sure something isn't working).
Sorry for wasting your time.
- Will -
Alter system trigger - substitution
Hello.
By the documentation, there is restriction for trigger on alter command: "The trigger will not be fired by an ALTER DATABASE statement".
I'm trying to use BEFORE SHUTDOWN and AFTER STARTUP triggers to database and I'd need also cover situations:
- alter system quiesce restricted
- alter system suspend
- alter system enable restricted session
- alter system unquiesce
- alter system disable restricted session
- alter system resume
I'm using ALTER SYSTEM command (not ALTER DATABASE), but trigger isn't fired too. Is there any way how to catch and do some PL/SQL pre/post processing events described above?
Thanks.Oracle Version ?
if ur on 10.x.x.x.x
Check
sql> select space_limit/1024/1024 "Limit MB",round(space_used/1024/1024) "Used MB"
2* from v$recovery_file_dest
SQL> /
Limit MB Used MB
2048 1681
If limit and used field equal then increase db_recovery_file_dest_size parameter size
SQL> show parameter db_recovery_file_dest_size
NAME TYPE VALUE
db_recovery_file_dest_size big integer 2G
SQL> alter system set db_recovery_file_dest_size = 3g;
System altered.
Also check below link.
>>>Re: Switch logfile hangs
[b]>>>SQL> alter system switch logfile; -
Alter system reset aq_tm_processes
Hi!
Trying to reset aq_tm_processes. First some background:
The aq_tm_processes parameter was first set in the pfile. We had to startup the DB using this file (tried removing it from the pfile also, not sure that worked as show parameter showed aq_tm_processes = 0).
But as we are using streams, aq_tm_processes, should not be set.
Well, I have done this:
1. Took down the DB.
2. Set the aq_tm_processes in the pfile to 2. (So I can issue the alter system command)
3. Startup nomount from pfile.
4. Created a new spfile form pfile.
5. Startup DB.
6. alter system reset aq_tm_processes scope=spfile sid='*';
7. Restarted the DB.
Is the aq_tm_processes now reset?
Show parameter shows the value 0.
alter system reset aq_tm_processes scope=spfile sid='*'
ERROR at line 1:
ORA-32010: cannot find entry to delete in SPFILE
It seems that the value is reset (as the parameter can not be found in the spfile). But Im still worried. Should the value show 0 if the parameter is reset?
Regards
PeterPeter, your question is not clear. Do you want the parameter to be set to 0? Run "show parameter aq", look at the value, if it is what you want, no problem. If it is not, set it to whatever value you want. Setting aq_tm_processes to 0 or not having it in your parameter file have the same effect.
-
Question about ALTER SYSTEM ARCHIVE LOG START
Good morning,
I'm trying (unsuccessfully) to get my database to be in archive log mode.
These are the steps I followed:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 377487824 bytes
Database Buffers 150994944 bytes
Redo Buffers 5804032 bytes
Database mounted.
SQL> select log_mode from v$database;
LOG_MODE
ARCHIVELOG
SQL> show parameter log_archive_start;
NAME TYPE VALUE
log_archive_start boolean FALSE
SQL> alter system archive log start;
System altered.
SQL> show parameter log_archive_start;
NAME TYPE VALUE
log_archive_start boolean FALSE
SQL>I've gone thru that process twice but, I don't seem to be able to get the ARCH process to start. (newbie mistake I'm sure...)
Thank you for your help (again!),
John.The parameter log_archive_start is no more needed John (as suggested already) and the best way to check the archive options is through the archive log list command.
[oracle@edhdr2p0-orcl oui]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Aug 10 10:51:57 2010
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 11
Current log sequence 13
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 418484224 bytes
Fixed Size 1336932 bytes
Variable Size 318769564 bytes
Database Buffers 92274688 bytes
Redo Buffers 6103040 bytes
Database mounted.
SQL> select process,status from V$archive_processes;
PROCESS STATUS
0 STOPPED
1 STOPPED
2 STOPPED
3 STOPPED
4 STOPPED
5 STOPPED
6 STOPPED
7 STOPPED
8 STOPPED
9 STOPPED
10 STOPPED
PROCESS STATUS
11 STOPPED
12 STOPPED
13 STOPPED
14 STOPPED
15 STOPPED
16 STOPPED
17 STOPPED
18 STOPPED
19 STOPPED
20 STOPPED
21 STOPPED
PROCESS STATUS
22 STOPPED
23 STOPPED
24 STOPPED
25 STOPPED
26 STOPPED
27 STOPPED
28 STOPPED
29 STOPPED
30 rows selected.
SQL>
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
archive log list;
Database altered.
SQL> Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 11
Next log sequence to archive 13
Current log sequence 13
SQL>
SQL> select * from V$archive_processes where status <> 'STOPPED';
PROCESS STATUS LOG_SEQUENCE STAT
0 ACTIVE 0 IDLE
1 ACTIVE 0 IDLE
2 ACTIVE 0 IDLE
3 ACTIVE 0 IDLEHTH
Aman.... -
RMAN ALert Log Message: ALTER SYSTEM ARCHIVE LOG
Created a new Database on Oracle 10.2.0.4 and now seeing "ALTER SYSTEM ARCHIVE LOG" in the Alert Log only when the online RMAN backup runs:
Wed Aug 26 21:52:03 2009
ALTER SYSTEM ARCHIVE LOG
Wed Aug 26 21:52:03 2009
Thread 1 advanced to log sequence 35 (LGWR switch)
Current log# 2 seq# 35 mem# 0: /u01/app/oracle/oradata/aatest/redo02.log
Current log# 2 seq# 35 mem# 1: /u03/oradata/aatest/redo02a.log
Wed Aug 26 21:53:37 2009
ALTER SYSTEM ARCHIVE LOG
Wed Aug 26 21:53:37 2009
Thread 1 advanced to log sequence 36 (LGWR switch)
Current log# 3 seq# 36 mem# 0: /u01/app/oracle/oradata/aatest/redo03.log
Current log# 3 seq# 36 mem# 1: /u03/oradata/aatest/redo03a.log
Wed Aug 26 21:53:40 2009
Starting control autobackup
Control autobackup written to DISK device
handle '/u03/exports/backups/aatest/c-2538018370-20090826-00'
I am not issuing a log swiitch command. The RMAN commands I am running are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u03/exports/backups/aatest/%F';
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u03/exports/backups/aatest/%d_%U';
BACKUP DATABASE PLUS ARCHIVELOG;
DELETE NOPROMPT OBSOLETE;
DELETE NOPROMPT ARCHIVELOG UNTIL TIME 'SYSDATE-2';
I do not see this message on any other 10.2.0.4 instances. Has anyone seen this and if so why is this showing in the log?
Thank you,
Curt SwartzlanderThere's no problem with log switch. Please refer to documentation for more information on syntax "PLUS ARCHIVELOG"
http://download.oracle.com/docs/cd/B19306_01/backup.102/b14192/bkup003.htm#sthref377
Adding BACKUP ... PLUS ARCHIVELOG causes RMAN to do the following:
*1. Runs the ALTER SYSTEM ARCHIVE LOG CURRENT command.*
*2. Runs BACKUP ARCHIVELOG ALL. Note that if backup optimization is enabled, then RMAN skips logs that it has already backed up to the specified device.*
*3. Backs up the rest of the files specified in BACKUP command.*
*4. Runs the ALTER SYSTEM ARCHIVE LOG CURRENT command.*
*5. Backs up any remaining archived logs generated during the backup.*
This guarantees that datafile backups taken during the command are recoverable to a consistent state. -
"Alter system set command" in a RAC database!!
Hi, all.
The database is (10.2.0.2.0) 2- node RAC database on 32-bit windows 2003
EE SP1.
I issued the following command on Node 1 database.
--> Alter system set db_block_buffers= xxx sid='rac1';
I was able to see "PE enqueue" in top 5 wait event section from an AWR report.
In addition, I was able to find "PZ99","PZ98" process dump file in BDUMP.
Soon later, I could find CKPT and DBWR hung.
Is there anyone who experienced this issue?
Thanks and Regards.
Message was edited by:
user50729010.2.0.2 has some bug which is fixed 10.2.0.3
You check sequence cache. If it has less value, increase it to 10000.
select CACHE_SIZE from dba_sequences where SEQUENCE_OWNER='SYS' and SEQUENCE_NAME='AUDSES$';
SQL> alter sequence sys.audses$ cache 10000;
Ashok -
Alter system archive log current
Hi everyone,
I write code to alter system archive log current in PL/SQL as following:
declare
start_sequence number;
end_sequence number;
begin
--- get start sequence# ---
select SEQUENCE# into start_sequence from v_$log where status='CURRENT';
--- get end sequence# ---
alter system archive log current;
select SEQUENCE# into end_sequence from v_$log where status='CURRENT';
end;
When I run it, I got the following error:
alter system archive log current;
ERROR at line 11:
ORA-06550: line 11, column 6:
PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
pipe
What does it mean? How can I fix it/
Thanks!That is because you are trying to issue a DDL call in PL/SQL. The only way you can achieve this is to use DYNAMIC SQL.
If you change your ALTER statement to:
EXECUTE IMMEDIATE 'ALTER SYSTEM ARCHIVE LOG CURRENT';It should work.
HTH! -
Hi, all.
I am looking for the oracle manual or html link with regard to the following command.
alter session set events 'immediate trace name systemstate level 10';
alter session set events 'immediate trace name hanganalyze level 3';
alter system set events '27468 trace name errorstack level 3';
alter system set events '27468 trace name systemstate level 10';
alter system set events 'immediate trace name events level 4';
I was not able to find related documents at the following links.
http://www.oracle.com/pls/db102/search?word=&partno=
Thanks and Regards.Metalink note 218105.1 gives information about how to set events. For specific events you can also search Metalink.
-
Please help me in this command alter system
I enter to DB as dba from toad and try to execute this command to alter the format mask of the date
ALTER SYSTEM SET NLS_DATE_FORMAT='dd/mm/yyyy' SCOPE =
SPFILE;
but this error come for me
ORA-02096: specified initialization parameter is not modifiable with this optionI am not sure why you got error? Its working fine for me,
SQL> alter system set nls_date_format='dd/mm/yyyy' scope=spfile;
System altered.
SQL> select * from V$version;
BANNER
--------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for Linux: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - ProductionHTH
Aman.... -
Abend while executing alter system kill session command
I have a ML350 G3 Hp server(Xeon 2.4 Ghz) running oracle 8.1.5 on Novell 5.1. Frequently i have locking problems in my software. So when i tried to kill the active session using alter system kill session 'sid, serial#' my server produce following error:
Fatal Exception (Number 14, cause abend: Page fault running process: orcl_000000fe code executing in module core81.nlm v8.1d at offset +6c490h). Any suggestions.This forum is for posting feedback about the OTN site.
The best place for your question is probably a Database forum.
There is a list of Database forums here:
http://forums.oracle.com/forums/index.jsp?cat=18 -
A problem within a third-party application is causing it to create and abandon Oracle sessions. At times three hundred or more abandoned sessions accumulated in the instance. The software company is working on the problem. Oracle's background processes will get rid of those sessions after several hours, but at times there were so many they caused the server to start using paging space. We wrote a SQL*Plus script to identify the abandoned sessions and kill them with command "alter system kill session <sid, serial#> immediate;". We automated the execution of the script a week ago. Today I noticed that in my udump directory an Oracle trace file has been created each time our script kills a session. A single trace file is created regardless of how many sessions are killed. No errors appear in the trace file.
Is the creation of these trace files an indication that problems have occurred or are they there for information only?
Since I know how and why the sessions are being killed, is it safe to ignore the trace files?
Thank you,
BillThe OS is AIX 5.2. The database server is 10.2.0.2. We are in the processing of upgrading to AIX 7.1 and database server 11.2.0.3.6.
The script does not enable tracing for the SQL*Plus session.
Below is the alert log message from a session killed at 11:22, and the corresponding trace file created at that same time:
From alert_<sid>.log:
Wed Jul 31 11:22:01 2013
Immediate Kill Session#: 1119, Serial#: 59885
Immediate Kill Session: sess: 70000014dc4a7e0 OS pid: 267254
/u02/admin/EXPRESS/udump $ ls -l express_ora_113358.trc
-rw-r----- 1 oracle dba 2276 Jul 31 11:22 express_ora_113358.trc
/u02/admin/EXPRESS/udump $ pg express_ora_113358.trc
Dump file /u02/admin/EXPRESS/udump/express_ora_113358.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /u01/app/oracle/product/10.2.0
System name: AIX
Node name: navis
Release: 2
Version: 5
Machine: 0005CD8C4C00
Instance name: EXPRESS
Redo thread mounted by this instance: 1
Oracle process number: 225
Unix process pid: 113358, image: oracleEXPRESS@navis
*** ACTION NAME:() 2013-07-31 11:22:01.181
*** MODULE NAME:(SQL*Plus) 2013-07-31 11:22:01.181
*** SERVICE NAME:(EXPRESS.WORLD) 2013-07-31 11:22:01.181
*** SESSION ID:(1723.61000) 2013-07-31 11:22:01.181
SO: 70000014d44d278, type: 2, owner: 0, flag: INIT/-/-/0x00
(process) Oracle pid=463, calls cur/top: 0/700000139166298, flag: (0) -
int error: 0, call error: 0, sess error: 0, txn error 0
(post info) last post received: 108 0 4
last post received-location: kslpsr
last process to post me: 70000014d36c398 1 6
last post sent: 0 0 24
last post sent-location: ksasnd
last process posted by me: 70000014d36c398 1 6
(latch info) wait_event=0 bits=0
Process Group: DEFAULT, pseudo proc: 70000014d6aec00
O/S info: user: oracle, term: UNKNOWN, ospid: 267254
OSD pid info: Unix process pid: 267254, image: oracleEXPRESS@navis
Short stack dump:
ksdxfstk+002c<-ksdxcb+04e4<-sspuser+0074<-00004CB0<-nttrd+0120<-nsprecv+0750<-ns
rdr+0114<-nsdo+1714<-nsbrecv+0040<-nioqrc+04a8<-opikndf2+0688<-opitsk+088c<-opii
no+0990<-opiodr+0adc<-opidrv+0474<-sou2o+0090<-opimai_real+01bc<-main+0098<-__st
art+0090
Dump of memory from 0x070000014D2CC3B0 to 0x070000014D2CC5B8
70000014D2CC3B0 00000004 00000000 07000001 39DA8D48 [............9..H]
70000014D2CC3C0 00000010 0003139D 07000001 39166298 [............9.b.]
70000014D2CC3D0 00000003 0003139D 07000001 4C73D508 [............Ls..]
70000014D2CC3E0 0000000B 0003139D 07000001 4DC4A7E0 [............M...]
70000014D2CC3F0 00000004 00031291 00000000 00000000 [................]
70000014D2CC400 00000000 00000000 00000000 00000000 [................]
Repeat 26 times
70000014D2CC5B0 00000000 00000000 [........]
Thanks,
Bill
Maybe you are looking for
-
Cannot add files to itunes after 10.0.1 update
After downloading and installing itunes 10.0.1 update, I cannot add files to my library. Anybody else have this issue? I have tried dragging/dropping files and file->add new files to library. I'm using a PC with windows xp
-
I have 3 tables with 3 different name for month field. table month A bill_mon B bill_month C month now on the basis of month field in where clause I want to take Export of above tables. How I can do it?
-
once made a download app paying with my credit card. I need to delete that card no longer descargsndo things for card payment
-
Report Painter - Download Capabilities
Greetings - Does anyone have any experience in downloading reports in bulk from Report Painter? The scenario is that we want to create a new CO report, Plan vs. Actual by cost center in a different format then SAP standard. We then want to be able
-
Hi There, I'm trying to use the EDK to query by a user's name, but I"m having a bit of trouble. In C#, I can use the code below to successfully query for a user(s) by ID. For example, here I want all users with user ID above 200: RemoteSession = Remo