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;

Monday, 15 July 2019

Recover MySQL or MariaDB root Password


[root@said-app ~]# systemctl stop mysqld.service
[root@said-app ~]# systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Mon 2019-07-15 13:02:37 +06; 9s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 13543 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 13520 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 13546 (code=exited, status=0/SUCCESS)

Jul 15 12:54:15 said-app systemd[1]: Starting MySQL Server...
Jul 15 12:54:16 said-app systemd[1]: Started MySQL Server.
Jul 15 13:02:35 said-app systemd[1]: Stopping MySQL Server...
Jul 15 13:02:37 said-app systemd[1]: Stopped MySQL Server.

[root@said-app ~]# systemctl stop mysqld.service
[root@said-app ~]# systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
[root@said-app ~]# systemctl start mysqld.service
[root@said-app ~]# systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-07-15 13:09:09 +06; 2s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 17109 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 17087 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 17112 (mysqld)
   CGroup: /system.slice/mysqld.service
           â””─17112 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid --skip-grant-tables

Jul 15 13:09:08 said-app systemd[1]: Starting MySQL Server...
Jul 15 13:09:09 said-app systemd[1]: Started MySQL Server.

[root@said-app ~]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> USE mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> update user set authentication_string=PASSWORD("said@321") where User='root' AND Host = 'localhost';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

[root@said-app ~]# systemctl stop mysqld.service
[root@said-app ~]# systemctl unset-environment MYSQLD_OPTS
[root@said-app ~]# systemctl start mysqld.service
[root@said-app ~]# systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-07-15 13:17:03 +06; 2s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 18468 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 18446 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 18471 (mysqld)
   CGroup: /system.slice/mysqld.service
           â””─18471 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Jul 15 13:17:02 said-app systemd[1]: Starting MySQL Server...
Jul 15 13:17:03 said-app systemd[1]: Started MySQL Server.


[root@said-app ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| baveefin           |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql>