How to skip delete on logical standby
Dear guys and gurus,
On next month i will have plan to delete history data on my Primary database, but i still want to keep them in logical standby as the data warehouse. So, how can i skip delete statement from primary database apply to logical standby.
Oracle SQL apply only support for Skip DML but not for keep delete statemen (on 10g and 11g)
SQL>exec dbms_logstdby.skip(statement => 'DELETE',schema_name => 'SCOTT', object_name => 'DEPT');
BEGIN dbms_logstdby.skip(statement => 'DELETE',schema_name => 'SCOTT', object_name => 'DEPT'); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'SKIP'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I do search and see one post about 3 years age about this question but still not answered.So, do you have any idea for this ???
So thanks and best regards.
Ch
You might want to play with this but here is an idea.
CREATE OR REPLACE PROCEDURE schema.handle_delete (
old_stmt IN VARCHAR2,
stmt_type IN VARCHAR2,
schema IN VARCHAR2,
name IN VARCHAR2,
xidusn IN NUMBER,
xidslt IN NUMBER,
xidsqn IN NUMBER,
error IN VARCHAR2,
new_stmt OUT VARCHAR2
) AS
BEGIN
-- Default to what we already have
new_stmt := old_stmt;
-- Ignore any GRANT errors on SYS or HR schemas
IF INSTR(UPPER(old_stmt),'DELETE') > 0
THEN
IF schema IS NULL
OR (schema IS NOT NULL AND
(UPPER(schema) = '<SCHEMA>' OR UPPER(SCHEMA) = '<SCHEMA>' )
THEN
new_stmt := NULL;
-- record the fact that we just skipped
END IF;
END IF;
END handle_delete;
Register the error handler with SQL Apply:
SQL> EXECUTE DBMS_LOGSTDBY.SKIP_ERROR ( -
statement => 'DML', -
schema_name => NULL, -
object_name => NULL, -
proc_name => 'SYS.HANDLE_DELETE');
Similar Messages
-
Audit DBA Activity, skip table from logical standby!
Dear All,
My database is 10gR2 on windows 2003 server.
I want to know if I can put some audit on the commands: execute dbms_logstdby.skip() to skip tables from Logical standby and also the same on unskipping the objects exec dbms_logstdby.unskip.
Thanks, ImranHi,
Given that your Database is 10g, the auditing options were extended to included DML from only SELECT in 9i, but not audit on procedures. You could double check the Fine Grained Auditing options in 10g, but I don't think this extends to DBMS_ packages.
I would consider writing a trigger or a small job that monitors the DBA_LOGSTDBY_SKIP view for additional entries. This is the only workaround that I can suggest that might fit your needs. -
How to skip DELETE command on logical standby?
IBM AIX 5.3
Oracle DB version 10.2.0.3
Can I skip just delete or update on the standy instead of all DML's on particular object using dbms_logstdby.skip,
e.g this will skip all DMLs on the test object.
exec dbms_logstdby.skip(statement => 'DML',schema_name => 'SCOTT', object_name => 'TEST');
Can I use 'DELETE' as a statement type in dbms_logstdby.skip to just skip delete on object.
exec dbms_logstdby.skip(statement => 'DELETE',schema_name => 'SCOTT', object_name => 'TEST');You can not skip all deletions on a particular table with a statement such as this....
You can use SKIP_TRANSACTION to skip a transaction or even multiple transactions but the Oracle documentation states:
is an inherently dangerous operation. Do not invoke this procedure unless you have examined the transaction in question through the V$LOGMNR_CONTENTS view and have taken compensating actions at the logical standby database.
SKIP_TRANSACTION Procedure
Specifies transactions that should not be applied on the logical standby database. Be careful in using this procedure, because not applying specific transactions may cause data corruption at the logical standby database.
Regards
Tim Boles -
Auto delete in logical standby
Environment
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for HPUX: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
2 instances in rac -->> apply to single instance logical standby Db.
Hello,
First,tnks in advance for the responses.In my logical Standby environment , i have set
EXECUTE DBMS_LOGSTDBY.APPLY_SET('LOG_AUTO_DELETE', 'TRUE');
,nut it only deletes the standby archives from the first instance of my production Db.The standby archives from the second do not delete.I have to do it manually.
In a semilar environment , everything works fine.I have checked all the configuration.Any help?
Tnks.
http://greekoraclebi.blogspot.com/
*************************It might be related to Bug 7341598 - Logical standby auto purge may leave some logs undeleted (Doc ID 7341598.8)
You might want to apply the latest PSU Bug 9352164 - 10.2.0.4.4 Patch Set Update (PSU) (Doc ID 9352164.8).
Larry -
How to exclude tablespace in logical standby database
Dear all,
In which way does the creation procedure of a logical standby database differ than the standard ORA9.2 procedure (http://www.oracle.com/pls/db92/db92.to_pdf?pathname=server.920%2Fa96653.pdf&remark=docindex) if I want to exclude a tablespace in my standby database?
Excluding tablespace in physical standby database is impossible.
Thanks in advance.The goal of a stand by database is to become a clone fed online with transactions coming from the active database. If the cloned database in a physical dataguard configuration diverges from the active database it is useless, as transaction control takes place at a lower level (physical addresses are involved).
~ Madrid -
How to import schema into logical standby database
i had created a new schema(A)in different database and exported the schema into a dmp file using export utility
from the exported dmp file i want to import that schema(A) into logical standby database using import utility
iam importing as system user .
i am getting the following error
IMP-00003: ORACLE error 1031 encountered
ORA-01031: insufficient privileges
can some one help what was going wrong.
thank you in advance.
kalyanHi kalyan,
May u plz let us know which import command you are using? kinldy check that your system user has import/export privileges?
Thanks
Hassan Khan -
How to Skip/delete line under report name
Hi,
How to delete line under report name
Thanks,,Hi,
Edit The Title View and goto Format Title View just near to brush symbol ie above the word Title
Border -> Position -> None
Thanks,
Balaa... -
How to automatically delete archivelogs on standby using RMAN?
Hello team. I just setup a physical standby on windows environment. The primary database is been backed up via RMAN and everything works fine except that the archivelogs moved to standby site are not been deleted.
I couldn't find some rman option to add to the scripts to take care of this issue.
Environment:
Windows 2003 server 32bits
Oracle Database 9.2.0.8
Thanks in advance!If you were using 10g or later you could use a deletion policy as per Oracle support note ID 728053.1.
In 9i you need to schedule an RMAN job or shell script to delete these archives, e.g.:
RMAN> delete archvielog all completed before 'sysdate-1';
I have not tried it, but you can schedule also a PL/SQL script to take care of this, e.g.:
http://www.dbasupport.com/forums/archive/index.php/t-18680.html
http://gnjatovic.blogspot.com/2011/03/delete-applied-arhivelogs-on-standby.html -
Skipping dependent Tables in Logical Standby
Hello DBAs
I need your expertise here. Let me explain the scenario. Suppose a table is skipped in a logical standby. This table is referred by other tables and there are dependencies on this table. Now my question is what happens when a transaction is committed at the primary which is dependent on this table ?
Does the transaction go through even though that table is not replicated. What happens to data integrity ?
I appreciate your help. Thanks.Have a go at
[The Documentation...|http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/manage_ls.htm#SBYDB00800] -
Is CDC feature working on the logical standby database
I would like to implement CDC on the standby logical database instead of primary production database. Is CDC working on the logical standby database??
Thanks.Thanks. My database version is: 10.2.0.4.0 and no plan to upgrade to 11g.
Either asyn or syn CDC on logical standby database is ok for me. I searched but couldn't find any docs for how to set CDC for logical standby, they are all for primary database.
Please help. -
Shutdown Logical Standby Server
How can I gracfully shutdown logical standby server and start it ? Please write the steps
ThanksHello,
$> sqlplus '/as sysdba'
$> shutdown immediate ;
or
$> shutdown;
$> startup force nomount
or
$> startup force nomount pfile='..../yourinitstandby.ora'
$> alter database mount standby database.Verify in alert.log file that standyby server started and mounted.
Regards -
How to delete the foreign archivelogs in a Logical Standby database
How do I remove the foreign archive logs that are being sent to my logical standby database. I have files in the FRA of ASM going back weeks ago. I thought RMAN would delete them.
I am doing hot backups of the databases to FRA for both databases. Using ASM, FRA, in a Data Guard environment.
I am not backing up anything to tape yet.
The ASM FRA foreign_archivelog directory on the logical standby FRA keeps growing and nothing is get deleted when
I run the following command every day.
delete expired backup;
delete noprompt force obsolete;
Primary database RMAN settings (Not all of them)
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 9 DAYS;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE DB_UNIQUE_NAME 'WMRTPRD' CONNECT IDENTIFIER 'WMRTPRD_CWY';
CONFIGURE DB_UNIQUE_NAME 'WMRTPRD2' CONNECT IDENTIFIER 'WMRTPRD2_CWY';
CONFIGURE DB_UNIQUE_NAME 'WMRTPRD3' CONNECT IDENTIFIER 'WMRTPRD3_DG';
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
Logical standby database RMAN setting (not all of them)
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 9 DAYS;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
How do I cleanup/delete the old ASM foreign_archivelog files?OK, the default is TRUE which is what it is now
from DBA_LOGSTDBY_PARAMETERS
LOG_AUTO_DELETE TRUE SYSTEM YES
I am not talking about deleting the Archive logs files for the Logical database that it is creating, but the Standby archive log files being sent to the Logical Database after they have been applied.
They are in the alert log as follows under RFS LogMiner: Registered logfile
RFS[1]: Selected log 4 for thread 1 sequence 159 dbid -86802306 branch 763744382
Thu Jan 12 15:44:57 2012
*RFS LogMiner: Registered logfile [+FRA/wmrtprd2/foreign_archivelog/wmrtprd/2012_01_12/thread_1_seq_158.322.772386297] to LogM*
iner session id [1]
Thu Jan 12 15:44:58 2012
LOGMINER: Alternate logfile found. Transition to mining archived logfile for session 1 thread 1 sequence 158, +FRA/wmrtprd2/
foreign_archivelog/wmrtprd/2012_01_12/thread_1_seq_158.322.772386297
LOGMINER: End mining logfile for session 1 thread 1 sequence 158, +FRA/wmrtprd2/foreign_archivelog/wmrtprd/2012_01_12/threa
d_1_seq_158.322.772386297
LOGMINER: Begin mining logfile for session 1 thread 1 sequence 159, +DG1/wmrtprd2/onlinelog/group_4.284.771760923 -
Logical standby | archive log deleted | how to remove gap ???
hi gurus...
i have problem on logical standby
by mistake standby log coming to logical standby has been deleted , now how to fill up the gap ???
ON STANDBY
SEQUENCE# FIRST_CHANGE# NEXT_CHANGE# APPLIED
228 674847 674872 YES
229 674872 674973 CURRENT
230 674973 674997 NO
231 674997 675023 NO
232 675023 675048 NO
233 675048 675109 NO
234 675109 675135 NO
235 675135 675160 NO
236 675160 675183 NO
237 675183 675208 NO
238 675208 675232 NO
239 675232 675257 NO
240 675257 675282 NO
241 675282 675382 NO
242 675382 675383 NO
243 675383 675650 NO
244 675650 675652 NO
245 675652 675670 NO
246 675670 675688 NO
247 675688 675791 NO
248 675791 678524 NO
archive log are shipping to standby location also and getting registered
ALERT LOG OF STANDBY
Fri May 7 12:25:36 2010
Primary database is in MAXIMUM PERFORMANCE mode
RFS[21]: Successfully opened standby log 5: '/u01/app/oracle/oradata/BEST/redo05.log'
Fri May 7 12:25:37 2010
RFS LogMiner: Registered logfile [u01/app/oracle/flash_recovery_area/BEST/archivelog/archBEST_248_1_715617824.dbf] to LogMiner session id [1]
but i dont have standby log after 229 sequence ...
ON PRIMARY
SYS@TEST AS SYSDBA> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/flash_recovery_area/TEST/standlogOldest online log sequence 247
Next log sequence to archive 249
Current log sequence 249
what to do next to apply sequences and bring both in sync.
please help me ,,,,
Edited by: user12281508 on May 7, 2010 9:45 AMthanks for response.
no its pure logical standby
i have tried to ftp the archive logs of primary to standby and applied manually
SYS@BEST AS SYSDBA> alter database register logfile '/u01/app/oracle/flash_recovery_area/BEST/archivelog/archBEST_230_1_715617824.dbf';
alter database register logfile '/u01/app/oracle/flash_recovery_area/BEST/archivelog/archBEST_230_1_715617824.dbf'
ERROR at line 1:
ORA-01289: cannot add duplicate logfile
SYS@BEST AS SYSDBA> alter database register logfile '/u01/app/home/archTEST_230_1_715617824.dbf';
alter database register logfile '/u01/app/home/archTEST_230_1_715617824.dbf'
ERROR at line 1:
ORA-01289: cannot add duplicate logfile
any other way ???? -
Skip the DELETE command on logical standby
Hi All,
I want to skip the DELETE command on logical standby.
DB Version - 10.2
OS - Linux
Primary DB and logical standby DB .
In our DB schema some transaction tables. We delete data from those tables by delete commands.
Delete command, also delete data from logical standby DB. But we want to skip on logical standby DB .
I use following for that and get error.
ALTER DATABASE STOP LOGICAL STANDBY APPLY;
EXECUTE DBMS_LOGSTDBY.SKIP (stmt =>'DELETE TABLE', schema_name =>'TEST',object_name =>'TRANS',proc_name => null);
ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;
But I got error
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'SKIP'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
When I change stmt =>'DELETE TABLE' to stmt =>'DML', no error happen
Please help me to solve this issue . This is urgent.
Thanks in advance.
RegardsDear aditi2,
Actually it is so simple to understand the problem. Please read the following documentation and try to understand the SKIP procedure.
http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/d_lsbydb.htm#997290
*SKIP Procedure*
Use the SKIP procedure to define filters that prevent the application of SQL statements on the logical standby database.
By default, all SQL statements executed on a primary database are applied to a logical standby database.
If only a subset of activity on a primary database is of interest for application to the standby database,
you can use the SKIP procedure to define filters that prevent the application of SQL statements on the logical standby database.
While skipping (ignoring) SQL statements is the primary goal of filters,
it is also possible to associate a stored procedure with a DDL filter so that runtime determinations can be made whether to skip the statement,
execute this statement, or execute a replacement statement.
Syntax
DBMS_LOGSTDBY.SKIP (
stmt IN VARCHAR2,
schema_name IN VARCHAR2,
object_name IN VARCHAR2,
proc_name IN VARCHAR2,
use_like IN BOOLEAN,
esc IN CHAR1);Hope That Helps.
Ogan
Edited by: Ogan Ozdogan on 30.Tem.2010 13:03 -
ORA-01403 - Logical Standby Apply ends on delete/update statement
- This thread is relocated to this forum; advice from Daniel Roy -
After implementing 2 logical standby databases and running pretty smooth for a while 'strange' errors occur which puzzle me. Sometimes I skip a transaction or exclude a schema from replication and hold my breath for what next roars its ugly head.
Despite fulfilling all logical standby prerequisites and maintaining primary keys on tables I now run into ORA-01403 errors. The updated table only contains 1 row and has a foreign key to another small table.
I could instantiate these tables, but I want to understand why these errors occur and prevent them form happing or learn how to resolve them best.
Anyone around who dealt with these matters and won?
I'm running this implementation with Oracle 9.2.0.7 on Tru64 51.b
I'm able to create the logical standby databases manually and with aid of the Data Guard Creation Wizard (EM10g 10.1).
Can anyone also help me out with refining the faulty transaction from e.g. V$LOGMNR_CONTENTS? (Without disrupting the data guard setup).
I've already retrieved redo info from archivelogs, but there must be an easy way.
Regards,
ErikAny way for you to turn tracing on for the DB where you see this ORA-01403 error? We could then probably find out exactly what goes wrong. It's very hard for us to know exactly what might be wrong, since we don't know your exact setup (except for this table). Let me know if that's not possible, and I could construct a logical DB setup to test (even tho it would be on Windows, I don't have Tru64).
Daniel
Maybe you are looking for
-
Lock up and attempted restart on recent recordings
Recordings made since about 10 days ago are giving me problems. They will lose sound about 1 second before freezing. After about 1 minute the vbox than tries to restart itself, but the restart screen just flickers every 10 seconds like it's recycling
-
HELP- can't view contact info in address book
i've got the address book in 'book' view (left contacts - right contact detail)... i click on a contact and the details do not show up to right- it's 'stuck' on my 1st contact detail. the only way to view contact detail is by double clicking contact
-
HP Officejet 7610 randomly printing off center.
The header says it all, when printing one copy will be perfect, then the next comes out off center towards the right of page. Does it randomly whether printing one at a time or in multiples. Many more prints come out off center than not. Have updated
-
Error Conversion Currencies.
Dear Experts, I have a failed load to the cube from ODS. The problem is the currency conversion in the update rule. The monitor details is as follows. Data Package 1 Error conversion foreign curr. -> local curr.: 0000421784 20071008 USD -> TMZ Error
-
Everytime i start the mail program to get my new mails, the activity bar get stucked at the same spot of incoming mails. all incoming mails left still the server of my provider (he sees zero mails there). so the 29 new mails are already on the way to