Dropping public synonyms in a pluggable database

I have an Oracle 12c container database with several pluggable databases in it.  In one of the pluggable databases, I de-installed OLAP by running the following scripts:
SQL> @%oracle_home%/olap/admin/catnoamd.sql
SQL> @%oracle_home%/olap/admin/olapidrp.plb
SQL> @%oracle_home%/olap/admin/catnoxoq.sql
SQL> @%oracle_home%/olap/admin/catnoaps.sql
After running the scripts, I then generated the SQL statements to remove invalid OLAP synonyms, by executing the following:
select 'drop public synonym ' || object_name || ';'
from dba_objects
where status <> 'VALID'
and owner = 'PUBLIC'
and object_type = 'SYNONYM'
and object_name like '%OLAP%';
When I execute the resulting SQL statements in the pluggable database, I get the following error for all of them:
ERROR at line 1:
ORA-65040: operation not allowed from within a pluggable database
If I switch back to the CDB$ROOT container and execute the same statements, I get the following error:
ERROR at line 1:
ORA-01432: public synonym to be dropped does not exist
How can I remove these invalid public synonyms from my pluggable database?

OK - let's go back to the basics
For 12c you should NOT be manually removing/uninstalling/disabling Oracle options.
There is a CHOPT utitlity specifically designed to enable or disable certain options.
http://docs.oracle.com/cd/E11882_01/install.112/e48740/post_inst_task.htm#CHDFEIJF
5.2.7 Enabling and Disabling Database Options
When you install Oracle Database, some options are enabled and others are disabled. To enable or disable a particular database feature for an Oracle home, shut down the database and use the chopt tool. See Example 5-1.
The chopt tool is a command-line utility that is located in the ORACLE_HOME/bin directory. The syntax for chopt is:
That doc section shows that one of the 'db_option' values available is 'olap' to disable. NOTE: the uttility DISABLES the option. It is still not clear to me why you would attempt to actually deinstall it.
If your concern is licensing then all you need to do is disable it. It is very possible that you have corrupted that PDB by attempting a manual uninstall. Only Oracle support could tell you for sure.
If it is a new PDB and licensing is your issue you may be far better off starting over and using CHOPT to disable the options you don't want.
1. why are you 'unistalling' olap in the pdb? What PROBLEM are you trying to solve?
2. why are you manually dropping synonyms?
3. how did you decide to execute those particular scripts? Is there an Oracle doc you are following that has instructions for deinstalling olap? Does that doc give you the order to execute the scripts in?
If you review the catnoamd.sql script you will see that just about ALL that it does is drop public synonyms.
Most of those synonyms that it drops have 'olap' in the name.
Which suggests that if Oracle wanted those synonyms YOU are trying to drop to be dropped you have to wonder why it didn't drop them itself in that script.
Was that script the FIRST script you executed?
1. Modify your 'drop' script to simply create the DDL to drop the synonyms.
2. Then examine the data dictionary to see what objects those synonyms refer to.
3. Then check if those objects still exist or not
4. Also check those scripts to see if they did anything (e.g. drop) those objects.
Post the results of the above.

Similar Messages

  • Permission name for "drop public synonym"

    We can drop public synonym as:
    GRANT DROP PUBLIC SYNONYM TO User1;How the permission/role is named to run this statement?
    Which table can i query to see if my logged in user has this right?
    I googled but didnt find.

    DROP PUBLIC.. can be granted to a ROLE and that ROLE in turn can be granted to an USER. Also this can be granted directly to the user.
    SELECT * FROM dba_role_privs; --To find the ROLES granted to the USER
    SELECT * FROM role_sys_privs; --To find the privileges granted to a ROLE
    SELECT * FROM dba_sys_privs; --To find the system privileges granted to a USERYou can use DBMS_METADATA also
    SELECT DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT','YOUR_ROLE_NAME') from dual
    SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT','YOUR_ROLE_NAME') from dual
    SELECT DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT','YOUR_ROLE_NAME') from dual

  • Cannot drop public database link

    Hi all.
    Just trying to drop some old database links and getting the following:
    SQL> select * from dba_db_links where host = 'V638';
    OWNER DB_LINK USERNAME HOST CREATED
    PUBLIC V638 SYSADM V638 23-SEP-04
    SQL> drop public database link V638;
    drop public database link V638
    ERROR at line 1:
    ORA-02024: database link not found
    There was another db link in there called V638.WORLD and when I issued
    drop public database link v638 it removed that one with no errors...
    Any way I can get rid of this other one?
    Version info:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    PL/SQL Release 9.2.0.4.0 - Production
    CORE 9.2.0.3.0 Production
    TNS for Solaris: Version 9.2.0.4.0 - Production
    NLSRTL Version 9.2.0.4.0 - Production
    Thanks

    Yes I already tried that...
    SQL> select * from global_name;
    GLOBAL_NAME
    VTEST1.WORLD
    SQL> alter database rename global_name to test.world;
    Database altered.
    SQL> alter database rename global_name to test.world;
    Database altered.
    SQL> select * from global_name;
    GLOBAL_NAME
    TEST.WORLD
    SQL> drop public database link v638;
    drop public database link v638
    ERROR at line 1:
    ORA-02024: database link not found
    SQL> alter database rename global_name to vtest1.world;
    Database altered.
    SQL> select * from global_name;
    GLOBAL_NAME
    VTEST1.WORLD

  • Grants problem in public synonym created though Database link

    Hi all,
    I have created the public synonym by using the table in the remote db in schema A.
    create public synonym test_syn for test_syn@rating.
    Now I want to grant a another user (say B) to access privillages on test_syn.
    (unable to grant the sysnonym using grant select on test_syn to B )
    Database link has been created by the user A.
    Please lat me know how I can grant select on synonym test_syn to B in this case.
    Thanks and regards
    Buddhike

    I think you should grant right on the original object (test_syn@rating)

  • Cann't Drop public database link

    I am not able to drop public database link .
    Oracle Version - 11.2.0.1.0 - 64bit Production
    Os Version - Sun Solaris .
    When I am going to drop a public database link it's give a error :
    SQL Error: ORA-00604: error occurred at recursive SQL level 1
    ORA-20000: Can not drop Object
    ORA-06512: at line 2
    00604. 00000 - "error occurred at recursive SQL level %s"
    Can anyone help to resolve this problem? It is a Production Database and it's a Urgent .
    Thanks,
    Dip Sankar Rana

    You say:
    I already given syntax of creating Public database link.
    But you should give real details (exact statements and exact results) to make it clear what you are attempting and what your problem is.
    Please show:
    - The CREATE PUBLIC DATABASE LINK statement (obscuring the password, of course) and its result (i.e. success or failure message)
    - From each of schema1 (working) and schema2 (not working):
    - - The result of SELECT USER FROM DUAL;
    - - The result of SELECT USER FROM DUAL@DB_TST;
    - - The result of SELECT COUNT(*) FROM ALL_OBJECTS@DB_TST WHERE OWNER = 'B1';
    In the meantime, an observation.
    You said:
    I create a public db link from schema1 to other database using below command --
    CREATE PUBLIC DATABASE LINK DB_TST
    CONNECT TO B1 IDENTIFIED BY password
    USING 'SPPROD'Note that any user (in caps: ANY USER) on this database can use this link to connect to database SPPROD as B1 without knowing the password - because you put the credentials in the link.
    If you have a PUBLIC database link with credentials, like you do here, you have a serious, glaring security exposure. You really, REALLY should not do this. Use a private database link (available only to the user that created it) or do not put credentials on the link (so that any user using that link is using his own credentials to connect to the remote database).
    Edited by: mtefft on Jan 14, 2011 4:14 AM

  • Export Database Link & Public Synonyms using Expdp

    Dear All,
    We are using expdp to do schema level exports:
    expdp dumpfile=<Directory>:expdp.dmp SCHEMAS=S1,S2,S3
    We also want to export the Public/Private Synonyms (created for the objects owned by above users), Public/Private Database Links as part of above command.
    How we can achieve this? We are using 11gR2.
    regards,
    Riaz

    HI,
    Public synonym can not be exported and never exported even at FULL Export also. . You can get them from "dba_synonyms". I suggest that you create so customer script .
    select      'create public synonym ' || table_name || ' for ' || table_owner || '.' || table_name || ';'
    from      dba_synonyms
    where
         owner='PUBLIC' and table_owner not in ('SYS', 'SYSTEM')
    order by
         table_owner;
    More: Information:
    https://forums.oracle.com/thread/855639?start=0&tstart=0
    Oracle Data Pump Schema Export and Public Synonyms
    Thank you

  • Can I use flashback database to flashback a pluggable database?

    Hi All,
    I created a container database and then created a pluggable database.
    In the pluggable 12.1 datbase, I loaded the user data.
    I performed the below
    sqlplus / as sysdba;
    create restore point CLEAN_DB guarantee flashback database;
    And I performed the transactions on the pdb.
    Now my intention is to restore to the restore point CLEAN_DB as created from the above step.
    If I perform the below, will it restore my pdb to the initial state?
    flashback database to restore point CLEAN_DB;
    Regards,
    Kamal.

    Hi,
    You cannot use FLASHBACK DATABASE for pluggable database.
    Flashback query/versions queryis UNDO based and work in PDB’s
    Flashback transaction query/flashback transactionis UNDO and REDO based and work in PDB’s
    Flashback data archiveUNDO gernerated archives
    Flashback table
    before drop –> Rename segment name of recylebin, which is based on UNDO, work in PDB’s
    flashback table to –> is UNDO based, work in PDB’s
    Flashback databasedoesn’t work in PDB’s:
    RMAN> flashback pluggable database prmdb01 to time "to_date('23:00 20-11-2013','hh24:mi dd-mm-yyyy')";
    Starting flashback at 25-NOV-13
    using channel ORA_DISK_1
    using channel ORA_DISK_2
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of flashback command at 11/20/2013 23:00:00
    RMAN-05108: Command is not supported for pluggable database
    Regards
    Mahir M. Quluzade
    p.s. Command exists but not supporting, may be next release come support.

  • DB Links vs. Public Synonyms Security issue

    I have been debating on using either a public synonym or a db link for my purpose. I have a dev, test, and prod database. I have applications that have been developed using a public synonym. I know that if I were to switch to db links I would have to go back and change the applications to have access to the tables. I was wondering if it would be more secure to just have the public synonyms with select privilege or have db links. I need to decide if I should use db links for various users in the same DB (e.g. prod) and to use db links from one DB to another. Can someone explain what the security risks are between the two and which would be safer to use?
    Thanks

    I appreciate that you have taken the time to read my post. The version of the database I am using is 10g. I guess to clarify my post I am asking if someone can provide me advantages and disadvantages of using either public synonyms or db links. I don't know if I am clear, but when I refer to a DB Link I am referring to the following type of access where a client in a database A can access information in a remote database B (e.g. schema1.table2@databaseB). I am not sure what you mean by "Database links are two entirely different technologies that do two entirely different things". But I would appreciate if someone with DBA experience can provide some insight regarding security issues associated with using public synonyms and db links.
    Thank you,

  • DB Link Public Synonym

    Hi Guys
    I have a public SYNONYM that was created to access a table on the remote database using a DB Link.
    We are able to access the DB Link using SQL Plus and the Synonym BUT when the same is used inside the cursor query of a PL/SQL block we get the following error message!
    This is driving me crazy... need your expert suggestion :)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Errors for PROCEDURE SP_PROCESS_SESEBA031:
    59/12 PLS-00341: declaration of cursor 'V_CUR' is incomplete or
    malformed
    60/9 PL/SQL: ORA-01775: looping chain of synonyms
    60/9 PL/SQL: SQL Statement ignored
    95/15 PL/SQL: Item ignored
    123/9 PL/SQL: SQL Statement ignored
    124/18 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    127/9 PL/SQL: Statement ignored
    127/12 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    148/13 PL/SQL: SQL Statement ignored
    161/37 PL/SQL: ORA-00904: "V_DTL_REC"."TRADE_DATE": invalid identifier
    161/37 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    180/9 PL/SQL: Statement ignored
    180/53 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    182/9 PL/SQL: SQL Statement ignored
    213/14 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    213/24 PL/SQL: ORA-00984: column not allowed here
    Compile source: /usctreg1/app/db/proc/SP_PROCESS_SESECRC.src
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Thanks & Best Regards,
    Faisal.

    Hi,
    As I say, when we access the synonym (that links to a table through a DBLINK) we have this issue. The code can be as simple as
    DECLARE
    var1 int := 0;
    CURSOR S1 IS SELECT col1, col2 from TB_DBLINK;
    BEGIN
    LOOP through Cursor S1
    END;
    Here the TB_DBLINK is:
    CREATE PUBLIC SYNONYM TB_DBLINK FOR TB_DBLINK@DBL1
    The TB_DBLINK on the DBL1 is also a Public Synonym... So it means that a Public Synonym is being created for a Public Synonym!
    Able to access this using SQL Plus simple select though :(

  • JDev app wizard unable to see public synonyms

    When running through reverse engineering to create middle-tier entities/views/assoc/links, the wizard was unable to give me the option of choosing from among public synonyms. I checked under SYSTEM, SYS users but the synonyms I wanted did not appear.
    When I created non-public synonyms in a schema, JDev did find them.
    PS: The synonyms access tables and views on another server using database links.
    null

    Are you logging on as yourself or as the owner of the objects? If you are logging on as yourself then you will only see the objects owned/created by you.
    If you want to see objects owned by other users click "other users" and click on the user that owns the objects that you want to view. If you do not have 'select' privs on the object then you will not be able to see the object in another users account.

  • Performance of DB Link VS Public Synonyms

    1) In a single database(Oracle 9.2) , I have multiple schema say a, b ,c d ,e etc.Currently we are using public synonyms to access tables of other schema.There is a plan to split the database into two or three DB and to use db links instead of public synonyms.So what would be impact on performance?
    2) In a same database for accessing multiple schema objects which one between DB link and Synonym is a better approach and why? How are the working mechanism for each of them?
    Appreciate your quick response.

    MSINHA wrote:
    No, on the same server we will have different instances. We are trying to split the schema into separate DB so as to independently upgrade them as they are for different applications and modules but some of the tables are common and being accessed using public synonym.Horrible idea to run multiple database instances on a single server. This is not how servers scale.
    Oracle scales by adding more servers to a single database - this is called RAC.
    Your approach is the exact opposite. Adding more databases to a single server.
    That approach seldom makes any technical sense - and is usually forced by circumstances (like running 2 different Oracle versions) and not by sound technical, performance and scalability reasons.
    Keep in mind that an Oracle database is NOT architecturally and technically the same as a mySQL or SQL-Server database. A mySQL/SQL-Server database is called a schema in the Oracle environment.

  • Do I need to deploy Public Synonym in Target Schema?

    Hi,
    I need to develop and deploy a mapping. I need to use source table in source schema but a Public Synonym for a terget table. This destination table for the public synonym is not target_schema where mapping is to be deployed. Do I still need to deploy the public synonym into my target schema where mapping is or not? I was 3wandering since its a public synonym and the actual destination table is already in database I may not have to deploy this synonym. Thanks for the help in advance..

    OWB does not currently directly support public synonyms. You will have to deal with these synonyms outside OWB and if you use the synonym from a mapping you can trick OWB to use it by creating and using a dummy table in the mapping.
    Regards:
    Igor

  • Export of public synonym in oracle

    Hi All,
    I am trying to export the database dump in oracle 10g using expdp command.But when I am trying to import that file i found that public synonym are missing.
    Can anyone help me its very urgent.
    expdp system/oracle directory=export dumpfile=<<x.dmp>> logfile=<<y.log>> schemas=ww_admin
    TIA,
    Ravi

    Hi,
    You can write a script to spool the list of public synonyms.
    set feedback off
    set trimspool on
    set pagesize 1000
    set linesize 1000
    set heading off
    spool public_synonyms.txt
    select      'create public synonym ' || table_name || ' for ' || table_owner || '.' || table_name || ';'
    from      dba_synonyms
    where
         owner='PUBLIC' and table_owner not in ('SYS', 'SYSTEM')
    order by
         table_owner;
    spool off
    exit
    Hope it helps.
    Regards,
    Z.K.

  • Public synonyms- when it is good/bad practice

    When would you say that public synonyms that (reference tables) are a good things, recommended things?
    I understand that mostly public synonyms are like triggers that should be avoided. Because they create possibility of confusion that one is not sure what is he referencing, if there is in two schemas table with same name, and code is written without schema prefix to reference those tables.
    I understand that if lot of code have written without schema prefix and now a table is planned to move to other schema, then it is perhaps good to create the public synonym so that code that was referencing without schema prefix a table can work successfully still.
    Can you explain generally when you would use public synonyms, in which situations?

    Yes you are right.
    The public synonyms can confuse us sometimes. the creation of public synonyms are useful when you are using the DBlinks from one database to another to read or write records. Because specifying the DBlink name at every time is not possible we may forget to use it as @dblink; at quries.
    In this case it is useful.
    While refreshing schemas to another database you have to take care these public synonyms to be created in new database also.
    Thanks

  • F4 describe for packages with public synonyms error

    v1.1.0.23 If I hit the F4 key to do a describe for a package that has a public synonym, an error box pops up that says "No valid query. No query found for version of the selected database" . After 5 presses of the OK button, a flyout window displays that contains the package spec.

    Hi
    I am not sure but maybe you need to use this command:
    SQL> insert into ums_sita_address values
    ('EK','EK','DXB',SITA_ADDRESSES_TY());
    SITA_ADDRESSES_TY() instead SITA_ADDRESSES_NT
    Regards

Maybe you are looking for