Friday, November 20, 2015

Using expdp to export (only) data

Many a times we need to export the data from a schema/database.Following expdp command could be used for achieving it


expdp scott/tger  directory=DATA_DUMP  dumpfile=Scott.dmp logfile=Scott.log schemas=scott content=data_only

Thursday, November 19, 2015

Truncate table using synonyms

Had migrated a new set of code into our test instance,which had  truncate statement.This truncate procedure and  the table to be truncated were on separate schema.

Error was as below:

Error report -
SQL Error: ORA-00942: table or view does not exist
00942. 00000 -  "table or view does not exist"

Had created all the synonyms and also granted "DROP ANY TABLE" privilege to owner of the procedure.

As part of troubleshooting it was found that we cannot truncate a table through its synonym.Need to prefix the schema name of the object for the truncate to happen.

"Synonyms cannot be used in a drop table, drop view or truncate table/cluster statements." - http://www.adp-gmbh.ch/ora/concepts/synonyms.html