Monday, April 27, 2020


orapwd gives OPW-00029 Password complexity failed in #Oracle 12.2


When I tried to create a password file for a 12.2 database, it initially failed with my favorite (simple) password:
[oracle@uhesse dbs]$ orapwd file=$ORACLE_HOME/dbs/orapwprima password=oracle

OPW-00029: Password complexity failed for SYS user : Password must contain at least 8 characters.
Two options to resolve this: Either provide a password that passes the complexity check, like:
[oracle@uhesse dbs]$ orapwd file=$ORACLE_HOME/dbs/orapwprima password=Very_Complex§1
Windows
orapwd file=C:\oracle\Administrator\product\12.2.0\dbhome_1\database\PWDIFS10CDB.ora format=12 password=Manager_1
Or create the password file in 12.1 format (default being 12.2 format)
[oracle@uhesse dbs]$ orapwd describe file=orapwprima
Password file Description : format=12.2 
[oracle@uhesse dbs]$ rm orapwprima
[oracle@uhesse dbs]$ orapwd file=$ORACLE_HOME/dbs/orapwprima password=oracle format=12
[oracle@uhesse dbs]$ orapwd describe file=orapwprima
Password file Description : format=12 

Tuesday, April 21, 2020


Export from pdb and import into pdb

In this post, we will see how we can take an export from one pdb and import into another pdb.

Step 1: Connect to pdb from where you want to take export :


SQL> alter session set container = orclpdb;

Session altered.

SQL> show pdbs

CON_ID   CON_NAME   OPEN MODE   RESTRICTED
------   --------   ---------   ----------
3        ORCLPDB   READ WRITE    NO


Step 2: Create a directory for data pump export :

SQL> create directory bkp as '/u01/';

Directory created.



Step 3: Create tns entry in tnsnames.ora for the pluggable database if not already done :

orclpdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)


Step 4: Grant necessary privileges to the user with whom you want to take backup :


SQL> grant read , write on directory bkp to hra;

Grant succeeded.

SQL>grant exp_full_database to hra;



Step 5: Take export using expdp and give clause full=Y


[oracle@12cws1 u01]$ expdp hra/hra@orclpdb directory=bkp dumpfile=hra_23082018.dmp logfile=hra_23082018.log full=y

Export: Release 12.2.0.1.0 - Production on Mon Aug 27 21:51:26 2018

Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Starting "HRA"."SYS_EXPORT_FULL_01": hra/********@orclpdb directory=bkp dumpfile=hra_23082018.dmp logfile=hra_23082018.log full=y
Processing object type DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/TABLE_DATA

Master table "HRA"."SYS_EXPORT_FULL_01" successfully loaded/unloaded
******************************************************************************
Dump file set for HRA.SYS_EXPORT_FULL_01 is:
/u01/hra_23082018.dmp
Job "HRA"."SYS_EXPORT_FULL_01" successfully completed at Mon Aug 27 21:57:06 2018 elapsed 0 00:05:31

[oracle@12cws1 ~]$



Step 6: Connect to target pdb where you want to import dump.

SQL> alter session set container = orclpdb2;

Session altered.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
4 ORCLPDB2 READ WRITE NO


Step 7: Create a directory for data pump import

SQL> create directory bkp as '/u01/';

Directory created.



Step 8: Create a tns entry

orclpdb2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb2)
)
)



Step 9: Import using impdp

[oracle@12cws1 u01]$ impdp system/oracle@orclpdb2 directory=bkp dumpfile=hra_23082018.dmp logfile=hra_23082018_imp.log full=y

Import: Release 12.2.0.1.0 - Production on Mon Aug 27 22:00:35 2018

Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Processing object type DATABASE_EXPORT/POST_SYSTEM_IMPCALLOUT/MARKER
Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 5 error(s) at Mon Aug 27 22:09:36 2018 elapsed 0 00:08:38

[oracle@12cws1 u01]$

Sunday, April 19, 2020


ORA-38760: This database instance failed to turn on flashback database


In a Prod database, flashback database was on and someone deleted a flashback log file.

so first I tried to off the flashback option then tried to open the database but it was reporting this error.  then figured out that we had few restore points (guaranteed restore point) created before.

So solution came after dropping those restore points and then tried to open.  you can see in below -

Database was in MOUNT mode.

SQL> conn / as sysdba
Connected.

SQL> alter database open;
  
*
ERROR at line 1:
ORA-38760: This database instance failed to turn on flashback database


SQL> alter database flashback off ;

Database altered.

SQL>
SQL> alter database open ;
alter database open
*
ERROR at line 1:
ORA-38760: This database instance failed to turn on flashback database


SQL> select name from v$restore_point;

NAME
--------------------------------------------------------------------------------
PRE_SWITCHOVER_PRODCDB
PRE_SO_PRODCDB_20181207

SQL> drop restore point PRE_SWITCHOVER_PRODCDB;

Restore point dropped.

SQL> drop restore point PRE_SO_PRODCDB_20181207;

Restore point dropped.


SQL> alter database open ;

Database altered.


SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> alter pluggable database all open;

Pluggable database altered.

Thursday, April 16, 2020


Oracle 11g/ 12C installation
DBCA error

No protocol specified Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264)

Solution, copy the file:
cp /root/.Xauthority /home/grid/.Xauthority
Insure that the user can read & write to the file by:
chmod 600 /home/grid/.Xauthority
chown grid /home/grid/.Xauthority

Wednesday, April 8, 2020


Physical Standby Switchover_status Showing Not Allowed. (Doc ID 1392763.1)

In this Document

Symptoms
Cause
Solution


APPLIES TO: Oracle Database - Enterprise Edition - Version 9.2.0.1 to 11.2.0.2.0 [Release 9.2 to 11.2]
Information in this document applies to any platform.

SYMPTOMS 

Before we initiate the switchover, we check the synchronization status between primary and physical standby. They are in perfect sync. Physical standby has applied the lastly generated archived redo log sequence. But in physical standby v$database.switchover_status shows "not allowed"

CAUSE

 It is expected to see this status in physical standby.
When we are certain that Primary and target standby are in sync,
We can then proceed with switchover exercise regardless of "not allowed" status in Physical standby

SOLUTION 

Switchover always originates from Primary database.
On the request of switchover sql statement
"alter database commit to switchover to physical standby with session shutdown",
Primary will generate special marker called EOR (end-of-redo) that is placed in the
header of online redo log sequence. So this online redo log sequence will be archived locally
and sent to all standby databases.

Only upon receiving and applying EOR (end-of-redo), v$database.switchover_status will change
from "not allowed" to "to primary" or "sessions active".
At this stage Physical standby is ready to assume Primary database role



Monday, April 6, 2020


Error 12154 received logging on to the standby


FAL[client, USER]: Error 12154

If you see this error message in alert log file of primary database. Check following points.
  • Check if your standby database is up and running and is registered with the Listener?
  • Check the value of parameter “FAL_SERVER” initialization parameter in standby database, and use “tnsping <FAL_SERVER>” on standby host to confirm if primary database is accessible through FAL_SERVER TNS entry form standby database.
  • Make sure that password file is present on standby and it is exact copy of primary database. In case of RAC, make sure that all primary RAC nodes have exact copy of password file and also same password file is copied on all standby RAC nodes.
  • Check whether environment variable TNS_ADMIN is set to a correct value and TNSNAMES.ORA file exists at the location set for this variable. To confirm that TNS_ADMIN was set correctly when database was started, execute following steps.

if Above mentioned steps are ok. Follow below step for last chance

SOLUTION
=========

SQL>  alter system set log_archive_dest_state_2='defer';

SQL> alter system set log_archive_dest_2 = '.....';

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=stby NOAFFIRM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=STBY';

– Switch logfiles on the Primary

SQL> alter system switch logfile;


3) On the Standby Database:

– Cancel Managed Recovery

SQL> alter database recover managed standby database cancel;

– Shutdown the Standby Database

SQL> shutdown immediate

SQL> startup mount;

SQL> alter database recover managed standby database using current logfile disconnect;

6) Re-enable Log Transport Services on the Primary:

SQL> alter system set log_archive_dest_state_2='enable';



  RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time https://shivanandarao-oracle.com/2012/12/05/rman-20207-until-time-or-re...