I imported a full oracle dump file into my database schema using the following command in linux ssh.
impdp system/password directory=bckup schemas=sch101 dumpfile=sc101.dmp remap_schema=sch101:MY_SCHEMA TABLE_EXISTS_ACTION=APPEND;
This command imported must of the tables into me target schema but some of the tables were skipped due to some constraint error.
I wanted to try to import these tables into my database after fixing the problem one by one. I used following command for doing so,
impdp system/password DIRECTORY=bckup TABLES=TBL_NAME DUMPFILE=sch101.dmp remap_schema=sch101:MY_SCHEMA TABLE_EXISTS_ACTION=APPEND;
But this command returns me error:
ORA-39002: invalid operation
ORA-39166: Object SYSTEM.TBL_NAME was not found.
I checked the name of the tables I tried to import in the export log file of the dump file that I used and they exist in the dump file.
What is that silly mistake that I am doing here?
Because you're importing as system from what is presumably a full (not schema) export, you need to specify the schema name in the tables parameter, despite the presence of the schema parameter:
... TABLES=sch101.TBL_NAME ...
The error message you're getting refers to SYSTEM.TBL_NAME, which clearly (or hopefully, anyway) isn't what you want.
Related
I have excel files that follow the same table structure, but varying file names and sheetnames (usually due to dates). I can not use script task. I have succesfully followed the top example here that loads files despite sheetname and file name. However, I encountered a new error, the example works when the column names are in the first row, but when they all start in a different row, thus requiring a sql command from variable, the example does not work.
The variable I use is "SELECT * FROM [" + #[User::SheetName] +"A9:AB99999]" which equates to SELECT * FROM [Bdx-Nov$A9:AB999999]. I follow every step from example exactly, but when using this variable opposed to just sheetname variable package returns following error:
An OLE DB record is available. Source: "Microsoft Access Database Engine" Hresult: 0x80004005 Description: "The Microsoft Access database engine could not find the object ''Bdx-Nov$'A9:AB99999'. Make sure the object exists and that you spell its name and the path name correctly. If ''Bdx-Nov$'A9:AB99999' is not a local object, check your network connection or contact the server administrator.".
Error: 0xC020204A at Data Flow Task - Load File, Excel Source [14]: Unable to retrieve column information from the data source. Make sure your target table in the database is available.
But previewing with the sql command variable does work, any insight to resolve this?
I still have not figured out the root cause of the error, but a solution that works with the above linked guide is to use table variable opposed to SQL command from variable.
So rather than create a variable that looks like so: SELECT * FROM Sheet1$A9:AG
I instead created a variable like so: #[User::SheetName] + "A9:AG" = Sheet1$A9:AG
The original problem was sql command from variable would preview in excel source but package execution would return error stating it can not find such a sheet. Now with table variable, preview and package execution work.
I created a dump file dumpfile.dmp in Oracle 12c for a schema say A from the source database, then I tried to import the dump file to several schemas say B, C, D on another database TESTDB with one command using the schema_remap option. The command looks like this:
impdp system/password#TESTDB directory=mydirectory dumpfile=dumpfile.dmp remap_schema=A:B,C,D remap_tablespace=TBS_A:TBS_B,TBS_A:TBS_C,TBS_A:TBS_D logfile=mylogfile.log.
I even put the command in .par file but I still get the same error.
It always come back with error "UDI-00014: invalid value for parameter, 'remap_schema'"
I will appreciate if anyone can tell me what I am doing wrongly?
You need to take a closer look at the syntax for REMAP_SCHEMA (and REMAP_TABLESPACE).
There is no provision for remapping one exported schema (or tablespace) to multiple destination schemas (or tablespaces).
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sutil/datapump-import-utility.html#GUID-5DA84A72-B71C-4491-9DD8-7075D9A4B04F
If your follow-up question is 'so how do I accomplish this purpose?' the answer is to run a separate import for each destination schema.
tried to import the dump file to several schemas say B, C, D
remap_schema=A:B,C,D
You can't do that; DataPump doesn't support that kind of remap. remap_schema must be a 1:1 relationship, as must remap_tablespace, and the source must be unique (i.e. you can only remap schema A once per import). Per the documentation:
Multiple REMAP_SCHEMA lines can be specified, but the source schema
must be different for each one.
You will have to run separate imports for each target schema.
impdp system/password#TESTDB directory=mydirectory dumpfile=dumpfile.dmp remap_schema=A:B remap_tablespace=TBS_A:TBS_B logfile=mylogfile.log
impdp system/password#TESTDB directory=mydirectory dumpfile=dumpfile.dmp remap_schema=A:C remap_tablespace=TBS_A:TBS_C logfile=mylogfile.log
impdp system/password#TESTDB directory=mydirectory dumpfile=dumpfile.dmp remap_schema=A:D remap_tablespace=TBS_A:TBS_D logfile=mylogfile.log
Here is my use case:
I have two different dump files, from two different external sources, both exported with exp (so classical dumps): export1.dmp and export2.dmp (as far as I can see, they were both exported with exp version V11.02.00. But I don't know anything more about them.)
For each one I run the imp utility (on Oracle 12c) with the indexfile option, in order to generate an sql file containing the table and index create commands, like this:
(a) imp mytargetuser/password file=export1.dmp full=y indexfile=create1.sql
(b) imp mytargetuser/password file=export2.dmp full=y indexfile=create2.sql
In create1.sql every create statement gets generated with the table/index name prefixed by mytargetuser (which is what I want), like:
create table mytargetuser.table1 ...;
create index mytargetuser.index1 ...;
However, in create2.sql every create statement gets generated with the table/index name prefixed by someuser (which is probably a user in the original database, from where the dump was made):
create table someuser.table1 ...;
create index someuser.index1 ...;
Any idea why this difference in the output of the indexfile option? And if there is any way I can force imp to always behave like in the first case above (a): to use the user I run imp with as the schema prefix in the generated script (or to not prefix at all the table/index names with a schema name, that would be also good for me)? (Once again, I cannot influence in any way the how the dump is generated on the other end.)
The behaviour is indeed explained in the manual:
If you do not specify TOUSER, then Import will do the following:
Import objects into the FROMUSER schema if the export file is a full dump or a multischema, user-mode export dump file
Create objects in the importer's schema (regardless of the presence of or absence of the FROMUSER schema on import) if the export
file is a single-schema, user-mode export dump file created by an
unprivileged user
Based on the above one might surmise that export2.dmp "is a full dump or a multischema, user-mode export dump file", while export1.dmp "is a single-schema, user-mode export dump file created by an unprivileged user".
I want to create a SqlDataConnection type provider for a database with a table, which name is exactly 'System'.
During compilation I get an error:
The type provider 'Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders' reported an error:
tmpB600.cs(12,7): warning CS0437: The type 'System' in 'c:\Users\krajewa1\AppData\Local\Temp\tmpB600.cs' conflicts with the imported namespace 'System' in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll'. Using the type defined in 'c:\Users\krajewa1\AppData\Local\Temp\tmpB600.cs'.
[...] (hundreds of errors following)
To workaround it I've tried :
Using LocalSchemaFile with dbml file which does not contain 'System'
table. It did not help, still the same error.
Using ContextTypeName parameter (which I hoped would put types in another namespace). It did not help, still the same error.
Creating a synonym for System table. Of course original table was still there, so I got the same error.
Obviously, changing table name to '_System' does help, but is not feasible in practice in my case.
My problem is exactly the same as the one asked in this question:
SqlDataConnection type provider generates massive error with SQL Server 2008 R2.
However, in that thread users did not the find real cause of the problem and did not provide an answer.
I don't know F# but could you not create a SQL Server synonym for the problematic table name?
http://msdn.microsoft.com/en-gb/library/ms177544.aspx
CREATE SYNONYM [SystemTable] for [System]
And then refer to the table by the synonym instead of it's real name in your F# Code.
It might be possible to simply rename the table instead but if there are any other queries running against it they would need to be changed as well. The synonym means both names are valid
I am looking for the right tool to export specific rows (WHERE condition) of some oracle database tables. There is one column with CLOB Data which can be larger than 4000 characters, therefore exports as "INSERT INTO" statements do not work.
Using exp works but also exports the DDL, which gives errors when using imp as the Table is already existing.
Use the IGNORE=Y parameter when importing the dump file. This tells the import to ignore creation errors. Find out more.