impdp ORA-1775 Looping Chain Of Synonyms

After importing my dump file, I have reviewed my log file and found the below error being thrown multiple times:

ORA-01775: looping chain of synonyms

My oracle version where I faced the problem is: 11.2.03

To resolve this problem:

SQL> select owner, object_name, object_type, status from dba_objects where object_name like ‘%SYS_IMPORT_SCHEMA_01%’;

The result of the query:

master tables

So I have dropped these tables:

SQL> drop table SYS.SYS_IMPORT_SCHEMA_01 purge;

Table dropped.

SQL> drop  table SYSTEM.SYS_IMPORT_SCHEMA_01 purge;

Table dropped.

Then, try to re-run impdp command again.

Remark: Those tables are orphan master tables due to the interruption of the impdp process. Normally master tables would be “dropped” after finishing the impdp.

Applying Patches on Oracle 12c Guide

This is an overview procedure on how to apply Oracle Patches (PSU) on Oracle 12cR1 databases (12.1.0.2). Its very important that you read the official documentation (readme.html) that is being provided with the patch being released in case oracle is listing new requirements.

********* STEPS for Applying PSU on 12c in Unix environment:

1.first collect preliminary database information and spool it in a file.

make a directory and call it before_patch: mkdir before_patch

cd before_patch

sqlplus ‘/as sysdba’

set pages 300
set lines 250
col owner for a17;
col object_name for a35;
col object_type for a20;
col action for a15;
col comments for a40;
col comp_name for a40;
col version for a15;

spool before_patch.log
SELECT NAME FROM V$DATABASE;
SELECT * from V$VERSION;
SELECT ACTION,VERSION,COMMENTS FROM SYS.REGISTRY$HISTORY;
SELECT * from dba_registry_sqlpatch;
SELECT COMP_NAME,VERSION,STATUS FROM DBA_REGISTRY;
select count(*) from dba_objects where status = ‘INVALID’;
select owner, count(*) from dba_objects where status <>’VALID’ group by owner order by 1;
Select owner, object_type, object_name
from dba_objects where status <>’VALID’ order by 1,2,3;
spool off

2. edit your Oracle inventory and make sure its pointing to the right location

3.shutdown listener and shutdown the database.

you can check the database listener name in your server by executing the unix command: ps -ef |  gep inh

or going directly to $ORACLE_HOME/network/admin and executing the command: lsnrctl stop listener_db1

4. in 12c the patches are being setup depending if you have JAVA component in your database or not.

For 12.1.0.2 if there is no JAVA component
go to the location of the patch:

cd ../20834354/20299023
then execute the OPatch utiltiy
OPatch/opatch apply -invPtrLoc /etc/oraInst.loc

For 12.1.0.2 if JAVA component exists
cd ../20834354/20415564
Opatch/12.1.0.1.7/OPatch/opatch apply -invPtrLoc /etc/oraInst.loc

*** the output will be similar to this:

Do you want to proceed? [y|n]
Y
Email address/User Name:
Press enter

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:
Yes

Is the local system ready for patching? [y|n]
Y

5. Run Bundle

##### To run the bundle for 12.1.0.2 FOR NON-JAVA
sqlplus ‘/as sysdba’
STARTUP
exit
cd $ORACLE_HOME/OPatch
./datapatch -verbose
—–Please make sure you receive the following message “Patch 20299023 apply: SUCCESS
sqlplus ‘/as sysdba’
col PRODUCT for a60;
col VERSION for a10;
col STATUS for a15;
col description for a60;
col action_time for a30;
set lines 133
select patch_id, version, status, description, action_time from dba_registry_sqlpatch order by 1;

##### To run the bundle for 12.1.0.2 FOR JAVA
sqlplus ‘/as sysdba’
STARTUP UPGRADE
QUIT
cd $ORACLE_HOME/OPatch
./datapatch –verbose
sql
shutdown immediate
STARTUP

6. Post Patching
cd
mkdir after_patch
cd after_patch
sql
sqlplus ‘/as sysdba’
col action for a15;
col comments for a40;
col comp_name for a40;
col version for a15;
set pages 300
set lines 300

spool after_patch.log
select name from v$database;
select * from v$version;
select ACTION,VERSION,COMMENTS from sys.registry$history;
select COMP_NAME,VERSION,STATUS from dba_registry;
select * from dba_registry_sqlpatch;
select count(*) from dba_objects where status = ‘INVALID’;
select owner, count(*) from dba_objects where status <>’VALID’ group by owner order by 1;
Select owner, object_type, object_name
from dba_objects where status <>’VALID’ order by 1,2,3;
spool off

Moving datafiles online in 12c

I want to share with you a very good new feature in 12c , you can now move “datafiles” ONLINE while applications are performing DML operations.

In 11g we used to put tablespace offline, then use the operating system “mv” command to move the datafile from one directory to another then use the command:

ALTER TABLESPACE RENAME ‘/orad08/oradbd14/DUMMY_SM.ORA’ TO ‘/orad07/oradbd14/DUMMY_SM.ORA’;

The drawback was that there is an outage while performing this operation.

Now, in 12c you can perform this operation ONLINE whit no issues.

To illustrate:

A tablepsace TS_DUMMY is currently having a datafile under orad07 directory

tablespace dummy

Executing the command:

SQL> ALTER DATABASE MOVE DATAFILE ‘/orad07/oradbd14/DUMMY_SM.ORA’ TO ‘/orad10/oradbd14/DUMMY_SM.ORA’;

alter database command

NOW the data file has been relocated after the successful execution of the command:

dummy after re-location

Another option is using the same command with the keyword “KEEP” which copies the datafile to the destination directory but keeps the datafile in original directory. However, the default tablespace will reflect the new moved data file !

SQL> ALTER DATABASE MOVE DATAFILE ‘/orad10/oradbd14/DUMMY_SM.ORA’ TO ‘/orad09/oradbd14/DUMMY_SM.ORA’ KEEP;

keep option

2 datafiles exist in both directories

datafile both exists

Default datafile will be the moved one

default data file

You can’t do that with TEMP datafile or Archive,…etc

trying to move tmep datafile