Monday, 21 October 2019

Find IP address or unique IP address from a log file

Scenario: In this scenario we will

-------Sample Log----

07-APR-2019 20:14:05 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=__jdbc__)(USER=WIN-MQ01PK54063$))(SERVICE_NAME=stlbas)(CID=(PROGRAM=)(HOST=__jdbc__)(USER=WIN-MQ01PK54063$))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.88.1.88)(PORT=50100)) * establish * stlbas * 0
07-APR-2019 20:14:06 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=__jdbc__)(USER=root))(SERVICE_NAME=emob)(CID=(PROGRAM=)(HOST=__jdbc__)(USER=root))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.11.1.95)(PORT=57193)) * establish * emob * 0
07-APR-2019 20:14:07 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=__jdbc__)(USER=root))(SERVICE_NAME=emob)(CID=(PROGRAM=)(HOST=__jdbc__)(USER=root))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.11.1.95)(PORT=57194)) * establish * emob * 0

07-APR-2019 20:14:27 * (CONNECT_DATA=(SERVICE_NAME=STLBAS)(CID=(PROGRAM=frmweb)(HOST=ISTELAR-08)(USER=root))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.11.1.228)(PORT=37861)) * establish * STLBAS * 0

07-APR-2019 20:14:29 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=emob)(CID=(PROGRAM=java)(HOST=HR-APP)(USER=root))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.88.1.174)(PORT=27081)) * establish * emob * 0


cat listener_07042019.log | awk '{ print $6 }' >> IP2.log
cat IP2.log | awk -F= '{print $4}' >> IP3.log
sed 's/......$//' IP3.log >> IP4.log
sort -u IP4.log 



cat listener_07042019.log | awk '{ print $6 }' >> IP2.log
-bash-4.1$ vim IP2.log
(ADDRESS=(PROTOCOL=tcp)(HOST=10.88.1.174)(PORT=63679))
(ADDRESS=(PROTOCOL=tcp)(HOST=10.88.1.88)(PORT=51571))
(ADDRESS=(PROTOCOL=tcp)(HOST=10.11.1.95)(PORT=56043))
(ADDRESS=(PROTOCOL=tcp)(HOST=10.11.1.95)(PORT=56044))
(ADDRESS=(PROTOCOL=tcp)(HOST=10.11.1.95)(PORT=56045))


cat IP2.log | awk -F= '{print $4}' >> IP3.log

-bash-4.1$ vim IP3.log
10.88.1.174)(PORT
10.88.1.88)(PORT
10.11.1.95)(PORT
10.11.1.95)(PORT
10.11.1.95)(PORT

sed 's/......$//' IP3.log >> IP4.log

-bash-4.1$ vim IP4.log
10.88.1.174
10.88.1.88
10.11.1.95
10.11.1.95
10.11.1.95

-bash-4.1$ sort -u IP4.log

10.11.1.121
10.11.1.126
10.11.1.133
10.11.1.144
10.11.1.162
10.11.1.163
10.11.1.167
10.11.1.198
10.11.1.221
10.11.1.224

Monday, 14 October 2019

MRP process down with ORA-10458 ORA-01157 ORA-01111 in Standby Database

idle@SYS> alter database open;
alter database open
*
ERROR at line 1:
ORA-10458: standby database requires recovery
ORA-01157: cannot identify/lock data file 274 - see DBWR trace file
ORA-01111: name for data file 274 is unknown - rename to correct file
ORA-01110: data file 274:
'/d01/app/oracle/product/12.1.0/db_1/dbs/UNNAMED00274'

Reason: 

This Error occurs if we add a Datafile OR Tablespace in PRIMARY Database and that could not be translated to the Standby Database due to these Reasons:
  • Standby_file_management is set to MANUAL
  • Primary & Physical Standby are having different file structures and DB_FILE_NAME_CONVERT is not set according to the Directory Structures in Primary and Standby
  • Insufficient Space or wrong Permissions on the Standby Database to create the Datafile
  • If standby_file_management is set to Auto ,but directory path of Primary and standby are different , db_file_name_convert is not set ,but db_create_file_dest has been set to wrong value on standby
Solution:

Step 1: set standby database file management parameter from AUTO to MANUAL.  (Standby Database)
BACDB@CDB$ROOT@SYS> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL; 

Step 2:  conn as sysdba and set pdb

SQL> alter session set container=;

Step 3: Create datafile as new

Alter database create datafile '/d01/app/oracle/product/12.1.0/db_1/dbs/UNNAMED00274' as '+DATA/bacdb/emob/image36.dbf' size 30G;

Step 4:  set standby database file management parameter from  MANUAL to AUTO (Standby Database)
BACDB@CDB$ROOT@SYS> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO; 

Step 5: Verify the Filename is correct

SQL> select name from v$datafile;

Step 6: Start the MRP (this is using Real Time Apply)
SQL> alter database recover managed standby database using current logfile disconnect;



Saturday, 28 September 2019

Error 'ORA-28081: Insufficient privileges - the command references a redacted object'


Reason:
-----------ERROR: ORA-28081

Error 'ORA-28081: Insufficient privileges - the command references a redacted object' occurs when performing DML/DDL by a schema on a object where one of the column has a redaction policy enabled.
If a redacted column appears as the source in a DML or DDL operation, then Oracle Data Redaction considers this as an attempt to circumvent the policy and prevents it with the error:
   ORA-28081 "Insufficient privileges - the command references a redacted object."


If a redacted column appears as the source in a DML or DDL operation, then Oracle Data Redaction considers this as an attempt to circumvent the policy and prevents it
with an 'ORA-28081: Insufficient privileges - the command references a redacted object' error unless you have the EXEMPT REDACTION POLICY system privilege.

Apart from a privileges issue it also prevents redacted data to enter the database and in the process lose the original truth.

Solution:

grant exempt redaction policy to ;

grant exempt redaction policy to SAID;