How to avoid warning "IMP-00041: Warning: object created with compilation warnings"? - oracle

I'm struggling with oracle import utility.
I'm running the script below and getting compilation warning. I have written a script to recompile all the objects after the import but I hate seeing those warnings every time a do a new export and reimport it. Can anyone help me with this issue ?
imp user/CHANGEME/host:8081/dbname fromuser=schemaowner touser=schemauser file=exp_$TODAY.dmp log=imp_$TODAY.log ignore=y
then run scripts like
alter view myview1 compile;
alter view myview2 compile;
alter view myview3 compile;
Is there any attribute or workaround to say please import the parents first then import the views and triggers ect..?

Related

Exporting schema from oracle database is breaking views

I am exporting with expdp a schema from a database and the process finishes with no error but when I try to use impdp to import the schema, several views fail to be imported with the following message:
ORA-39083: Object type VIEW failed to create with error:
ORA-00928: missing SELECT keyword
Failing sql is:
CREATE FORCE VIEW...
The create statement that is in the message effectively is missing the SELECT statement, because is truncated way before it should appear. When I check the VIEW in the source database the view is properly created.
The only possible cause I can see for this issue is the length of the statement given that all failing statements have between 389 characters and 404 characters at the point where the statements are truncated.
Is there a way to set the maximum number of characters that the expdp should be able to handle? Or is there a different way I which I should handle these views.

Import and replace package & procedure in oracle

I wanted to import packages and procedures to DB x from another DB y. I used expdp command with include=procedure, package in DB y to export the package and procedure.
In DB x some packages and procedure are already there, so those packages which exist, is showing "already exists", but I need to replace it with this dump as it has some modifications too. Is there any possible way where I can import and replace packages and procedures? It will be a hideous task to manually compile each package.
See this thread for a similar question and a suggestion:
https://dba.stackexchange.com/questions/204968/how-to-replace-and-overwrite-all-existing-objects-in-oracle-with-impdp-for-full
One other option I can think of is to: take export of the source schema and then drop only all the procedures and functions and packages (since you want to replace them anyway) and then run the import which will create them with target code.

Import a table from one user to another Oracle SQL

Is it possible to import a table from one user to another from export dmp file in Oracle?
If yes, how to do it?
I have 2 users: MILLER and DUMMY. MILLER has table Planets. I've made export from MILLER (last.dmp) using Command Prompt, and I want to make import the table into DUMMY user from export file.
I have already tried use information from here but it didn't help me.
I also can add log of command prompt, if necessary.
If you are using the "Original Import" Utility, you should consider that:
The user names must exist before the import operation; otherwise an error is returned.
The IMP_FULL_DATABASE role is required to use this parameter. To import to a different schema than the one that originally contained the object, specify TOUSER.
More information here
Thank you to all of you. Here is the solution:
1)grant IMP_FULL_DATABASE to DUMMY;
2)alter user DUMMY quota 50m on system; (because I had error
IMP-00058: ORACLE error 1950 encountered
ORA-01950: no privileges on tablespace 'SYSTEM'
Import terminated successfully with warnings.)
3)use FROMUSER and TOUSER in command prompt:
C:\>imp dummy#test3 fromuser=miller touser=dummy
Here is the complete process
Exporting:
expdp schema1/password dumpfile=Imported_Table1.dmp directory=DIR tables=sourceTablename;
Importing:
impdp schema2/password DIRECTORY=DIR DUMPFILE=Imported_Table1.dmp
remap_table=schema1.tablename:*destTablename*
remap_schema=schema1:schema2 TABLE_EXISTS_ACTION=append;
destTablename -> Table name in destination schema. If table exists, system import the data otherwise system creates a new table with the data.
Ref: TABLE_EXISTS_ACTION
Addressed Issues:
ORA-39002: invalid operation
ORA-39166: Object schema2.tablename was not found or could not be
exported or imported.
Table "schema2"."tablename" exists. All dependent metadata and data will be skipped due to table_exists_action of skip

How many errors are stored in the table USER_ERRORS for a package?

I compiled a package using the command
ALTER PACKAGE PKG_NAME COMPILE PACKAGE;
It had errors because some tables were not present. But all the non existent tables are not shown in USER_ERRORS. If I create the tables which are shown as non existing and compile the package again, then new errors are coming showing that some other tables are not existing. So is there any limit on the number of records in USER_ERRORS for a package or does Oracle stop compiling after a fixed number of errors are present?
"Does Oracle stop compiling after a fixed number of errors are present?"
I don't think so, but I believe it does stop compiling when it hits the first error in a particular block / statement.
So a block of code could have multiple errors but only the first will be reported. As you fix the errors, new ones in the same block will be revealed.

Alter Type in Oracle Fails with ORA-22324 and ORA-21700

I'm trying to add an attribute to an already existing Object Type in an Oracle 10.2.0.4 DB.
The schema is valid, and everything is working before running the following statement:
ALTER TYPE sometype ADD ATTRIBUTE (somefield varchar(14))
CASCADE INCLUDING TABLE DATA
/
SHOW ERRORS
The alter fails with an ORA-22324 and an ORA-21700.
Afterwards most of the schema objects which depend on sometype are invalid.
Compiling them all, restores the schema to a working state.
Anyone seen that kind of error?
ORA-22324 is "Altered type has compilation errors", and ORA-21700 is "Object does not exist or is marked for delete". Sounds like the body of your type may be referencing something which has been deleted.
I hope this helps.
I know this is old, but my answer may help people who find this later.
Make sure to disconnect and reconnect if your getting this, Its possible that will solve your issue.
However, Understanding the oracle Dev guide before altering types is important(especially when you have tables using the type):
Here is the object dev guide for oracle 9i:
http://docs.oracle.com/cd/B10501_01/appdev.920/a96594.pdf
Also points to recompiling the body
http://database-geek.com/2005/05/26/oracle-objects-types-and-collections-part-3/
EXEC DBMS_UTILITY.compile_schema(schema => 'SOME_SCHEMA'); --may also provide a useful results for you if you have alot of stuff that became invalid with your change.

Resources