Tuesday, February 27, 2018

RMAN Backup Job Session Kill

select b.sid, b.serial#, a.spid, b.client_info
from v$process a, v$session b
where a.addr=b.paddr and client_info like 'rman%';

SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,
ROUND (SOFAR/TOTALWORK*100, 2) "% COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%' AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK! = 0 AND SOFAR <> TOTALWORK;

alter system kill session 'sid,serial#' immediate;

alter system kill session '1918,58173' immediate;
alter system kill session '3803,34441' immediate;
alter system kill session '6603,32737' immediate;
alter system kill session '29,50741' immediate;

Database server IP changes

1) Changes ip in tnsnames.ora file.

2)  C:\Users\Administrator>sqlplus as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 20 13:49:54 2018

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1670221824 bytes
Fixed Size                  2176328 bytes
Variable Size            1275071160 bytes
Database Buffers          385875968 bytes
Redo Buffers                7098368 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 3728
Session ID: 5 Serial number: 5


SQL> startup mount
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64
bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

C:\Users\Administrator>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 20 13:52:26 2018

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

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area 1670221824 bytes
Fixed Size                  2176328 bytes
Variable Size            1275071160 bytes
Database Buffers          385875968 bytes
Redo Buffers                7098368 bytes
Database mounted.
SQL> alter database clear unarchived logfile group 1;

Database altered.

SQL> alter database clear unarchived logfile group 2;

Database altered.

SQL> alter database clear unarchived logfile group 3;

Database altered.

SQL> alter database open;
Database altered.

SQL>

Monday, February 26, 2018

Wallet

create wallet
add credentialstore
alter credentialstore add user ggadmin@SOURCEDB alias SOURCEDB domain admin
alter credentialstore add user ggadmin@TARGETDB alias TARGETDB domain admin
info credentialstore domain admin

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

alter system set local_listener = '(address_list=(address=(protocol=tcp)(host=drp4db-vip.nblbd.com)(port=1521)))';

As soon as I set the value of local_listener, PMON will know the port number on which listener is running and it will dynamically register the instance with listener.

Dataguard SYNC Check

Primary:
SQL> select thread#, max(sequence#) "Last Primary Seq Generated"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
group by thread# order by 1;

PhyStdby:
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;

PhyStdby:
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 val.applied in ('YES','IN-MEMORY')
group by thread# order by 1;


PhyStdby:
SQL> select al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied" , almax-lhmax "Sequence Difference"
from (select thread# thrd, max(sequence#) almax
from v$archived_log
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) al,
(select thread# thrd, max(sequence#) lhmax
from v$log_history
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) lh
where al.thrd = lh.thrd;


SQL> select sequence#,thread#,applied from v$archived_log where applied in ('IN-MEMORY','NO');

SQL> SELECT PROCESS, THREAD#,SEQUENCE# STATUS FROM V$MANAGED_STANDBY;

SQL> select name, value from v$dataguard_stats where name like '%lag%';