Determining the last archive applied on Logical Standby

Hi,
I am trying to determine the last log received and applied on my Logical Standby
SQL> select thread#, max(sequence#) "Last Standby Seq Received"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
group by thread# order by 1;
   THREAD# Last Standby Seq Received
         1                       14
SQL> select thread#, max(sequence#) "Last Standby Seq Applied"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
and applied='YES'
group by thread# order by 1;
Does not return anything
These statements work ok on a physical standby.
I know Sql Apply is enabled on my logical standby - my broker configuration is enabled and for the logical standby database, it is showing the Intended State as APPLY-ON with no Transport or Apply Lag on any of the databases
Q. How do I determine the last seq applied on my logical standby ?
thanks,
Jim

Hello;
I have this from my notes:
SELECT
  L.SEQUENCE#,
  L.FIRST_TIME,
  (CASE WHEN L.NEXT_CHANGE# < P.READ_SCN THEN 'YES'WHEN L.FIRST_CHANGE# < P.APPLIED_SCN THEN 'CURRENT' ELSE 'NO' END) APPLIED
FROM
  DBA_LOGSTDBY_LOG L, DBA_LOGSTDBY_PROGRESS P
ORDER BY SEQUENCE#;
Best Regards
mseberg

Similar Messages

  • When to use Real Time Apply for Logical standby..!!

    Hello All,
    I have been trying many ways to speed up the archival on primary and improve sql apply on logical standby, but still we are getting about 45-50 mins of delay between primary and logical standby.
    We wanted to have our transactions applied on logical standby within couple minutes. Which i guess wont be possible in async mode.
    That's why i am planning to implement Real Time apply between primary and logical standby.
    Now since both our databases are too far away from each other (Primary is in US and logical is in India) would it be recommended to implement real time apply in such scenario? And if implemented would it affect Primary DB Performance?
    Also if there might be some packet loss or network hitch would Primary will try again and keep logical DB in Sync with Primary?
    Any help or suggestions would be great.
    Thanks.

    yes, real time apply is recommended in your scenario.
    however due to the geographical distance between your primary and standby; I would suggest to keep your standby in current mode - max performance ; ASYNC- itself. It would not affect the performace of the primary.
    As long as you set the FAL parameters and configure tnsnames properly and ensure proper deletion policy for archivelog cleanup in primary ( so that it's not deleted before shipping if need be), you shouldn't find any problem with primary & standby synching.
    Good Luck.
    Cheers.

  • Last archive applied.

    Hi All,
    Is there any view which tells me that, which is the last archive file applied on my standby database.
    Regards.

    SQL> select max(SEQUENCE#) from v$log_history;
    MAX(SEQUENCE#)
             96130

  • Create function as "/ as sysdba" not shipped/applied to logical standby

    As the subject states, I was creating a password verify function and profile that used the function as sys "/ as sysdba" .
    The function was not created on the logical standby and thus the profile create statement failed. The function was not even listed in the standby's alertlog, although the create profile statement was.
    I created the function manually on the standby by connecting / as sysdba and creating the function and then restarted logical standby apply. The standby then created the profile and continued without error.
    Is this a bug?
    Should the SYS 'create function' be shipped and applied or not?
    When the function create statement was run on the primary as a non-sys user with DBA privs, it created ok and was shipped and appeared on logical standby ok.
    Any ideas DataGuard Gurus?
    (9.2.0.7 on Solaris 8)

    I logged a Tar. Oracle says:
    "Ideally any object created on sys schema should get skipped automatically. sys is consider as internal schema and objects created in sys schema should get
    skipped"
    "But because of the internal Bug.3576307 "LOGICAL STANDBY IS NOT SKIPPING DDL IT SHOULD." it is not skipping the DDL executed on sys schema. This bug
    is fixed in 10.2.
    You can issue following statement to enable the DDL skip on sys schema.
    SQL> ALTER DATABASE STOP LOGICAL STANDBY APPLY;
    SQL> EXECUTE DBMS_LOGSTDBY.SKIP_ERROR(‘SCHEMA_DDL’, ‘SYS’, null, null)
    SQL> ALTER DATABASE START LOGICAL STANDBY APPLY;
    After which all DDL errors encountered on any object in the SYS schema would be ignored and processing continued. This can render the TEST schema objects unusable and, if necessary, you can later recreate the tables
    using the INSTANTIATE_TABLE procedure."
    Makes sense now.

  • Controlling "Log apply" on Logical standby.

    Hi,
    We are going Live with logical standby ina day or two, and suddenly found what seems to be a potential problem in the near future.
    Despite issuing the command
    ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;Logs are not getting applied immediately. Each of the logfile is taking somewhere around 5 to 10 minutes. That, was considered not so serious a problem. But sometimes, we find that there are too many logfiles left behind, and it is taking more than a day to get applied. I don't know how to prevent such a situation. I don't know how to get them all applied if at all such situation arises.
    DB Version: 10.2.0.4
    O/S: RHEL 4
    Logfile size: 50M
    Please help. I will be prepared with all documents to face this situation.
    Aswin.
    Edited by: ice_cold_aswin on May 6, 2010 7:12 PM

    In Logical Standby the redo generated on the primary is converted to SQL and applied at the Logical Standby DB.
    Check the network to see if there is any latency. And also check the views like v$system_event to get an overview of the wait events on the Primary DB.
    Once refer to the docs for the Logical Standby Wait events.
    Edited by: user8710159 on May 6, 2010 10:15 AM

  • Slow apply on logical standby

    Hi ,
    oracle 10.2.0.3 enterprise edition logical standby
    We performed heavy updates on our production database due to which logical standby gone lots of logs behind with primary database and log are getting apply on logical standby very slowly.
    Kindly suggest how to speed up apply process on logical standby ....

    Santosh Pradhan wrote:
    Hi ,
    oracle 10.2.0.3 enterprise edition logical standby
    We performed heavy updates on our production database due to which logical standby gone lots of logs behind with primary database and log are getting apply on logical standby very slowly.
    Kindly suggest how to speed up apply process on logical standby ....Hope you are using "ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;" command
    Here please check the below note for Adjusting the Number of APPLIER Processes , also if redo transport is slow check the settings for "LOG_ARCHIVE_MAX_PROCESSES"
    http://docs.oracle.com/cd/B28359_01/server.111/b28294/manage_ls.htm#CHDBGBFC

  • Determine the last date of visit before FY selected in the slicer

    Hi,
    I have data for date wise clients visits.  My objective is to determine the last date of visit to the client before the FY selected in the slicer.
    The objective, data layout and question is available in this file
    http://sdrv.ms/19RnW0A
    Please help with the appropriate PowerPivot calculated Filed formula.
    Thank you.
    Regards, Ashish Mathur Microsoft Excel MVP www.ashishmathur.com

    Hi, basically this calculation would solve your initial question, though, it does not match the requested results:
    LastVisit:=CALCULATE(MAX(Data[Date]), DATESBETWEEN(Calendar[Date], BLANK(), MIN(Calendar[Date])-1))
    its important to add that this calculation only works if you mark your Calendar-table as Date-table which was not the
    case in the sample workbook!
    assuming you select 2012-2013, then according to your Calendar-table you select dates from 31/12/2012 till 30/12/2013
    so the "last date of visit to the client before the FY selected in the slicer." would be the last visit before
    31/12/2012 which would be 12/12/2012 for Client A and not 25/02/2012 as expected result
    hth,
    gerhard
    Gerhard Brueckl
    blogging @ http://blog.gbrueckl.at
    working @ http://www.pmOne.com
    Gerhard's approach is a nice clean solution.
    The only thing I would add is that we could use LASTDATE and FIRSTDATE instead of the MIN/MAX functions:
    LastVisit:=
    CALCULATE(
    LASTDATE(Data[Date]),
    DATESBETWEEN(
    Calendar[Date],
    BLANK(),
    FIRSTDATE(Calendar[Date]) -1)
    In order to achieve the overall outcome described in the uploaded Excel workbook, changes to the how the [Financial Year] and [Financial Year Key] are calculated will also need to be made (so that the slicer filters the correct data ranges).
    This can be done by using the suggested calculated column changes above or something similar.
    Having reviewed the requirement again, the logic behind the [Last Visit Last Year] measure that I proposed is slightly different from what is required because it only looks at the last visit date
    within the previous financial year to the one currently selected in the slicer. On the other hand Gerhard's is looking for the last visit date
    any time before the first date in the selected financial year and this is more in-line with the actual requirement. With the provided dataset, both approaches provide the same outcome, but the difference
    in behaviour would become apparent if the last visit date was not found within the previous financial year to the one selected in slicer.

  • How to determine the last transaction of a Batch Number

    Hello,
    For example,
    ITEMCODE - BATCHNUM - WHSCODE - LINENUM - DIRECTION
    ITEM1 - BATCH1 - WH1 - 0 - 0
    ITEM1 - BATCH1 - WH2 - 0 - 0
    ITEM1 - BATCH1 - WH1 - 1 - 1
    ITEM1 - BATCH1 - WH2 - 1 - 1
    How will I know that record number 4 is the last transaction regardless of the transaction type and warehouse code.  Is there any table which can help me solve this issue other than OIBT?
    Regards,
    Gilbert Ngo

    You could use the OINM Transnum (connected to the IBT1) to determine the last transaction:
    SELECT T1.[TransNum],
    T0.[ItemCode], T0.[BatchNum], T0.[WhsCode]
    FROM [dbo].[IBT1]  T0
    Join OINM T1 On T1.[BASE_REF] = T0.[BaseEntry]  and  T0.[BaseType] = T1.[TransType]

  • How to determine the "Last Value" in exception aggregation

    Hi gurus,
    I have a KeyFigure with an exception aggregation -Last value- by time.
    I report on a multiprovider ("containing" a infocube and a realtime infocube with BPS-InputLayout). I can correct separate Items with this BPS-Layout. So, at the end I have 2 values for one item.
    So, by these facts, my report shows the the last value for the specific KeyFigure, but I expected that both values (the value in the infocube and the correction via BPS)are sumed up.
    As this is due to the exception aggregation not the case, I could "overwrite" the normal value in the infocube with the BPS.
    But SAP determines the normal value in the Infocube as "Last Value", not the one in the correction cube, which is entered via BPS.
    How does SAP determine the "last value" as I can´t see any date...
    Thanks in advance!

    Thank you for your answer...
    I got the soltion by myself.
    I thought, Last Value means the last Value, depending on the time, but in my opinion the function last value should be called "Greatest Value".
    All figures with the same value for the reference characteristc are aggregated anyway.

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Archive apply issue for standby database in Standard Edition.

    We have setup standby database in Oracle standard edition. the archive log cannot be send by oracle automatically. So we manually send the archive over. But do not see the database apply the archive log file. What could be wrong and where should we check on it?
    We also used following when finishing the standby DB after running "recover standby database;" for a few archive log file:
    alter database recover managed standby database disconnect from session;
    ======================================================================================
    This is the status:
    SQL> select OPEN_MODE, SWITCHOVER# ,REMOTE_ARCHIVE ,ARCHIVELOG_CHANGE#,SWITCHOVER_STATUS, DATABASE_ROLE from v$database;
    OPEN_MODE SWITCHOVER# REMOTE_A ARCHIVELOG_CHANGE# SWITCHOVER_STATUS DATABASE_ROLE
    MOUNTED 495550636 ENABLED 1.2201E+13 SESSIONS ACTIVE PHYSICAL STANDBY

    The DB version is 10.2.0.5
    I can do this to apply at standby DB:
    SQL> set autorecovery on
    SQL> recover standby database;
    Then I tried to run this to leave the session:
    alter database recover managed standby database disconnect from session;
    Do not seen any apply.
    =============================
    Here is the last lines of alert log:
    Errors in file /oracle/admin/cntus/bdump/cntus_mrp0_12389.trc:
    ORA-00313: open failed for members of log group 1 of thread 1
    ORA-00312: online log 1 thread 1: '/u03/cntus/redolog/redo01b.log'
    ORA-27037: unable to obtain file status
    SVR4 Error: 2: No such file or directory
    Additional information: 3
    ORA-00312: online log 1 thread 1: '/u02/cntus/redolog/redo01a.log'
    ORA-27037: unable to obtain file status
    SVR4 Error: 2: No such file or directory
    Additional information: 3
    Thu Sep 06 15:08:34 EDT 2012
    Errors in file /oracle/admin/cntus/bdump/cntus_mrp0_12389.trc:
    ORA-00313: open failed for members of log group 1 of thread 1
    ORA-00312: online log 1 thread 1: '/u03/cntus/redolog/redo01b.log'
    ORA-27037: unable to obtain file status
    SVR4 Error: 2: No such file or directory
    Additional information: 3
    ORA-00312: online log 1 thread 1: '/u02/cntus/redolog/redo01a.log'
    ORA-27037: unable to obtain file status
    SVR4 Error: 2: No such file or directory
    Additional information: 3
    Clearing online redo logfile 1 /u02/cntus/redolog/redo01a.log
    Clearing online log 1 of thread 1 sequence number 10158
    Thu Sep 06 15:08:34 EDT 2012
    Errors in file /oracle/admin/cntus/bdump/cntus_mrp0_12389.trc:
    ORA-00313: open failed for members of log group 1 of thread 1
    ORA-00312: online log 1 thread 1: '/u03/cntus/redolog/redo01b.log'
    ORA-27037: unable to obtain file status
    SVR4 Error: 2: No such file or directory
    Additional information: 3
    ORA-00312: online log 1 thread 1: '/u02/cntus/redolog/redo01a.log'
    ORA-27037: unable to obtain file status
    SVR4 Error: 2: No such file or directory
    Additional information: 3
    Thu Sep 06 15:08:34 EDT 2012
    Errors in file /oracle/admin/cntus/bdump/cntus_mrp0_12389.trc:
    ORA-19527: physical standby redo log must be renamed
    ORA-00312: online log 1 thread 1: '/u02/cntus/redolog/redo01a.log'
    Clearing online redo logfile 1 complete
    Media Recovery Waiting for thread 1 sequence 10166
    Thu Sep 06 15:08:35 EDT 2012
    Completed: alter database recover managed standby database disconnect from session
    ======
    We have the directory /u02/cntus/redolog and /u03/cntus/redolog. But nothing in there. Should we create redo for it? Is this a separate issue?
    Thanks!

  • Redo data not applied on logical standby database 10g

    after a network problem within the primary and the logical standby database. The redo data is not applied on the logical standby even if all the archived log are sent to it.
    The below is the output from v$archive_gap and DBA_LOGSTDBY_LOG
    SQL> select * from v$archive_gap;
    no rows selected
    SQL> SELECT SEQUENCE#, FIRST_TIME, APPLIED
    FROM DBA_LOGSTDBY_LOG
    ORDER BY SEQUENCE#; 2 3
    SEQUENCE# FIRST_TIME APPLIED
    3937 24-FEB-10 01:48:23 CURRENT
    3938 24-FEB-10 10:31:22 NO
    3939 24-FEB-10 10:31:29 NO
    3940 24-FEB-10 10:31:31 NO
    3941 24-FEB-10 10:33:44 NO
    3942 24-FEB-10 11:54:17 NO
    3943 24-FEB-10 12:05:30 NO
    Any help?
    Thanks

    ORA-00600: internal error code, arguments: [krvxgirp], [], [], [], [], [], [], []
    LOGSTDBY Analyzer process P003 pid=48 OS id=8659 stopped
    Wed Feb 24 16:49:04 2010
    Errors in file /oracle/product/10.2.0/admin/umarket/bdump/oradb_lsp0_8651.trc:
    ORA-12801: error signaled in parallel query server P003
    ORA-00600: internal error code, arguments: [krvxgirp], [], [], [], [], [], [], []
    and below an Warning: Apply error received: ORA-26714: User error encountered while applying. Clearing. from oradb_lsp0_8651.trc
    Thanks

  • Skip archive log on logical standby

    hi ,
    I want to skip archive log from nmber 1150 to 1161 on logical standby dtbs.
    I knw , we can skip ddl , dml on logical standby .
    How can archive this ??
    (oracle 10g entreprise edition )

    Hello;
    I do not believe this is an option. The closest to this would be "applying modifications to specific tables"
    See :
    9.4.3 Using DBMS_LOGSTDBY.SKIP to Prevent Changes to Specific Schema Objects
    Data Guard Concepts and Administration 10g Release 2 (10.2) B14239-05
    While this is not the answer you want the skip Archive would create a Gap and cause many other issues you don't want.
    Best Regards
    mseberg

  • How to get the date of the last transaction in a mounted standby database?

    Hello,
    Could you tell me how to get the date of the last transaction recorded in a MOUNTED standby database?
    The following query doesn't work...because the database is not open...
    select scn_to_timestamp(current_scn) from v$database;
    Thanks

    Hi,
    You should be able to run the following command in mounted mode on standby database.
    select current_scn from v$database;
    then run the following to convert it to timestamp.
    select scn_to_timestamp(99999999) from dual; *<-- Replace here the SCN value you got above. This needs to be run on the primary database due to standby database in mount mode.*
    Alternatively you can also check at the alert.log file to find the last scn which has been applied.
    Regards
    Edited by: skvaish1 on Jan 19, 2010 11:15 AM

  • Real time apply for logical standby

    Hi
    Oracle 11.2.0.3.0
    I have a primary database orcl and logical standby database orcl_std.
    Real time apply is enabled. I have standby redologs in both primary and standby sides and I`ve started recovery with below command:
    ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;
    When I create a new table in primary database, I am unable to see it on standby database (Although real time apply is enabled)
    However, when I switch log in primary, I can see the new table in standby database.
    My question is, why realtime apply is not working in my scenerio ? I was expecting to see the new table immediately in standby database once it is created in primary database. Why am I supposed to wait for log switch in real time apply ?

    Using Real-Time Apply to Apply Redo Data Immediately
    http://docs.oracle.com/cd/E11882_01/server.112/e25608/log_apply.htm#i1022881
    1.What is compatible parameter, it should be 11.1
    2.Try to check parameters mentioned in below link:
    http://easyoradba.com/2011/01/10/real-time-apply-in-oracle-data-guard-10g/
    Regards
    Girish Sharma
    Edited by: Girish Sharma on Nov 15, 2012 12:37 PM

Maybe you are looking for