Importing data with impdp table with 3 new columns
Hello
Is it possible to import data with impdp in tables with 3 new columns?
Kind regards
William
To do this, I use this method:
Add the three columns in the source table and create the package:
CREATE OR REPLACE PACKAGE DATAPUMP_TECH_COLS
IS
FUNCTION SET_DML_DATE (p1 in TIMESTAMP)
BACK TO TIMESTAMP;
FUNCTION SET_DML_TYPE (p2 in VARCHAR2)
RETURN VARCHAR2;
FUNCTION SET_DML_SCN (p3 in NUMBER)
RETURN NUMBER;
END DATAPUMP_TECH_COLS;
/
CREATE OR REPLACE PACKAGE BODY SYS. DATAPUMP_TECH_COLS
IS
FUNCTION SET_DML_DATE (p1 in TIMESTAMP)
RETURNS THE TIMESTAMP
IS
BEGIN
SYSDATE RETURN;
END;
FUNCTION SET_DML_TYPE (p2 in VARCHAR2)
RETURN VARCHAR2
IS
BEGIN
RETURN ' ';
END;
FUNCTION SET_DML_SCN (p3 in NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN 0;
END;
END;
/
Export a table with remap_data
expdp = TEMP_DIR PARALLEL = 8 TABLES directory is PIVOTMAT2. ACCTG_LINE LOGFILE = expdp_acctg.log = COMPRESSION STATISTICS ALL EXCLUDE =.
DUMPFILE = ACCTG1.dmp, ACCTG2.dmp, ACCTG3.dmp, ACCTG4.dmp, ACCTG5.dmp, ACCTG6.dmp, ACCTG7.dmp, ACCTG8.dmp REUSE_DUMPFILES = YES.
REMAP_DATA = PIVOTMAT2. ACCTG_LINE. DML_TYPE:SYS. DATAPUMP_TECH_COLS. SET_DML_TYPE.------
REMAP_DATA = PIVOTMAT2. ACCTG_LINE. DML_DATE:SYS. DATAPUMP_TECH_COLS. SET_DML_DATE.------
REMAP_DATA = PIVOTMAT2. ACCTG_LINE. DML_SCN:SYS. DATAPUMP_TECH_COLS. SET_DML_SCN
Import table
Impdp "" / as sysdba "" DIRECTORY = SRC_PIVOT TABLE_EXISTS_ACTION = TRONQUER REMAP_SCHEMA = PIVOTMAT2:STGPIV.
DUMPFILE = ACCTG1.dmp, ACCTG2.dmp, ACCTG3.dmp, ACCTG4.dmp, ACCTG5.dmp, ACCTG6.dmp, ACCTG7.dmp, ACCTG8.dmp PARALLEL = 8
to complete the removal of the collar if necessary.
Tags: Database
Similar Questions
-
import data into the table with the triggers of the sequence
Hello
I'm on oracle 11G on OS SPARC.
I need to import a table from a dump using "imp."
At the destination table where I have to import a 'insert before' with the sequence as the primary key.
Suppose if I am importing data that has the sequence from 200... then when I imported the data into the new table, I have to define the sequence to be the same as the boot sequence for the source or it will automatically use this source sequence.
Please suggest
concerning
KkurkejaDisable the trigger prior to importation.
Thank you
-
import data with the command line switch
Is it possible to automatically import data to a .pdf file? My idea would be a command line switch, but another way would be appreciated also.
To explain myself better (my English is bad and I use a non-English version of Adobe Acrobat Reader):
I use Adobe Acrobat Reader DC and got a PDF with a lot of filelds. Now I can open the 'empty' file and import the data (.xml or .xdp format, I prefer .xml). It works very well.
I would like to stress that this task "import data" is performed automatically when I run the file - so I think that a command line parameter, but also another (macros?) way would be OK.
sincerely
Bruno
Open the FDF file instead. It must contain a key F name the PDF file.
-
The fastest way to import data for large tables
Hi friends,
I recently joined a billing product put up a team for TELECOM giant. Under the procedure of installation/initial tests, we have huge data (size of almost 1.5 billion records / ~ 200 GB of data) in some tables. Currently I use impdp to import. It takes a long time (almost > 9 hours to load these data).
I tried the ways below to import the data (all of these tables is partitioned):
1. normal impdp (single thread that is, parallel = 1): it takes a long time (> 24 hours).
2. normal impdp but partition-wise. It was completed in relatively less amout of time compared to the 1st method.
3 fall drop the index, framed adding another scheme in the same forum that includes data, and then recreate the index (whole process takes about 9 hours)
My questions at all:
1. is there any other way/trick in the book that I can try to put the data in less time
2. what I pointed out that even if I give parallel = 8 or more, sometimes parallel workers are laid and sometimes not. Can someone tell me why?
3. How can I come to know (before running the impdp) that my parallel article will spawn parallel workers or not. As to how I will come to find out, I searched this topic but without success.
I don't know what strategy to follow, because it is an involved and repetitive task for me. Because of the task above, I am not able to focus on other DBA tasks because of what comes to me.
See you soon,.
Malikaassuming that you have a table with 3 clues, then create a script for each index (reblace index_name_n with your index name) and start them at the same time, after the importation of the table is complete
DUMPFILE=
or NETWORK_LINK= DIRECTORY=DATA_PUMP_DIR LOGFILE= CONTENT=ALL PARALLEL=1 JOB_NAME=IMP_ INCLUDE=TABLE_EXPORT/TABLE/INDEX:"IN(' ')" TABLES= . Change the following settings when importing:
increase pga_aggregate_target
increase db_writer_processes
db_block_checking = false
db_block_checksum = falsethe value undo and temporary ts autoextend
Set noarchivelogmode
create logs of restoration of 4 GBHTH
Reading file from the ftp server and importing data into the table
Hi experts,
Well, basically, I text with different layout files have been uploaded to an ftp server. Now, I must write a procedure to recover these files, read and insert data into a table... what to do?
your help would be greatly helpful.
Thank youuser9004152 wrote:
http://it.Toolbox.com/wiki/index.php/Load_data_from_a_flat_file_into_an_Oracle_tableSee the link, hope it will work.
It is an old method, using the utl_file_dir parameter that is now obsolete and which is frankly a waste of space when external tables can do exactly the same thing much more easily.
Repeat the extensible data from a table in a new
Hello
I managed to create a table in LC designer4 growing - IE. It is a four-column table with a header line followed by a line where I can add information in three table cells. If I need to have another line I click on the line button Add (placed in the header row), and a new appears. There is also a button that can systematically remove deleted a row. I'll call this my parent table.
So far so good.
Maybe it's better to explain exactly what I'm doing here...
My parent table is a kind of to-do list he calls table X. Each column is as such: 1. what to do 2. who will do 3. When she will be
It is extensible, so if there is more than one action to be carried out it will add extra lines.
I also want to create a new table that is an update on the list to call this table Y:
column a. what needed to be done (these data are extracted directly from column 1 on the to-do list) column B: at - it to happen? column C: if not, why - columns B and C are new and do not pull the data from the to do list.
The problem is twofold: how repeat the data in the column 1 (given the fact that I can't use global data binding as column 1 can have several different entries), and if I can get past this first hurdle, how can I make automaticall table expand to the same amount of lines in table X?
I should mention that I'm a designer so my programming expertise is severely limited. I managed to create the first table by watching the tutorials rather than find out myself. As far as I know the first table is done in javascript.
Any help would be greatly appreciated!
You need to loop through the tables and copies the data from the field.
You have to adapt the example below for your table names and the reference field.
Table1 = table to copy from
Table2 = table to copy to
Row1 = name of the rank that the fields are
ColumnA = the name of the field being copied
Here is the script (put it on the Click event of a button):
Table2._Row1.count = Table1._Row1.count; var vCol1 = this.resolveNodes("Table1.Row1[*].ColumnA"); var vCol2 = this.resolveNodes("Table2.Row1[*].ColumnA"); for (var i = 0; i < vCol1.length; i ++) { vCol2.item(i).rawValue = vCol1.item(i).rawValue; }
Copy and update data from one table to the new table by using the Merge command
Hello
Can someone tell me please how to do this?
I have a table: EMP (ename, sal, empno (pk), dept) another table is EMP_CLASS ((pk) empno, ename)
I want to insert corresponding lines of emp to table emp_class if this line does'nt exists in emp_class
otherwise it will be update info by corrsponding emp_class table as well as remove of emp_class according to the emp delete operation.
Thank you
Madam.
Published by: Nico on August 12, 2010 22:59Have changed. PLS, run once more...
MERGE INTO emp_class
With the HELP of emp
WE (emp.empno = emp_class.empno)
WHEN MATCHED THEN
UPDATE
SET emp_class.ename = emp.ename,
emp_class. DEPTNO = emp.deptno,
emp_class. Class = decode(emp.deptno,10,1,20,2,30,3,40,4)
DELETE
WHERE emp_class.empno = emp.empno
WHEN NOT MATCHED THEN
INSERT (emp_class.empno, emp_class.name, emp_class.deptno, emp_class.class)
VALUES (emp.empno, emp.ename, emp.deptno, decode(deptno,10,1,20,2,30,3,40,4));P.S. Not tested
Thank you
Florian...Published by: Florian on August 13, 2010 01:53
transfer data from a table to a new table
Hello all;
I have a table called infosight and I would like to create a new table called wall. I have in my infosight table, the columns and the following data
Now I want to insert only the following fields, * ID *, * place *, * price * in the new table called workzone until bookid value does not already exist in the wall table. Thank you. I would be grateful for all the help I can get. Thank you.bookid place author price 123 NewYork James $320.20 124 London John $356.56 125 Tokyo Hui $456.0
Try PLS,
insert into workzone (bookid, place , price) select bookid, place , price from infosight where bookid not in (select book_id from workzone)
or some other way,
Insert into the wall (bookid, place, price)
values
Select bookid, place, price of infosight where ID in
(select bookid infosight less
Select wall book_id)Published by: sree on July 25, 2010 06:59
Copy data from one table to the new table
Hello
I copy data from columns of a table to another table and my query is
INSERT INTO TestTable (empno, empName, deptno)
SELECT empno, empname, deptno
WCP
and it works fine but I want to insert a data column in testTable based on emp.deptno
as if emp.deptno = 10 it will add 1 to the testtable.class column,
If emp.deptno = 20 it will add 2-column testtable.class,
If deptno = 30 it will add 3 to the testtable.class column,
TestTable structure is
EMPNO NUMBER (20)
ENAME VARCHAR2 (50)
DEPTNO NUMBER (20)
CLASS NUMBER (20)
Can someone please help me write this procedure.
Thank youYou can use a case statement as
INSERT INTO TestTable (empno, empName,deptno,class_column ) SELECT empno, empname,deptno, case when emp.deptno=10 then 1 when emp.deptno=20 then 2 when emp.deptno=30 then 3 end FROM emp
See you soon
KatiaHow to merge data from the table with a single line
Hello
I have three tables subscription_type, the address and the person. Here are the details of the table
Person Subscription_type Address
Person_Id AdressType_id Address_id
Person_name Description Address_type_id
Person_id
Address details
There are three types of different address - home, postal and previous.
Each person can have these three different addresses.
I want to create a view that displays all addresses of three of each person in the table of the person in a single line.
Any help please
In your example, there are 2 rows of columns street1, TOWN, SUBURB etc for a single person. To convert this into a single line, with the new columns we could simply use CASES or DECODE in the select as the SQL below. To understand why consolidation function THAT MAX is used - remove the MAX and GROUP BY in SQL keyword and try.
Select full_name
, max (case when description = "Home" then end street1) Home_Street
, max (case when description = "Home" then end suburb) home_suburb
, max (case when description = end of the "Home" then City) home_city
, max (case when description = "Home" then postal code end) home_postcode
, max (case when description = "Home" then end state_name) home_state
, max (case when description = 'Postal' then end street1) Postal_Street
, max (case when description = 'Postal' and then end of suburb) Postal_suburb
, max (case when description = 'Postal' then the city) Postal_city
, max (case when description = 'Postal' and then end of CP) Postal_postcode
, max (case when description = 'Postal' then state_name end) Postal_state
, max (case when description = "Back" then end street1) Prev_Street
, max (case when description = "Back" then end suburb) Prev_suburb
, max (case when description = "Back" then city end) Prev_city
, max (case when description = "Back" then postal code end) Prev_postcode
address a
S State
No p
Subscription_type att
where a.person_id = p.person_id
and a.state_id = s.state_id
and a.address_type_id = att.address_type_id
Full_name group
How to import data from the Excel worksheet file in a table DB using a filebrowse
Hi friends,
Im having a table has with the following columns as
< Li > ID
< Li > Employee_name
< Li > Department
with empty data in it.
Im having an excel sheet that contains the data for the table has for the column ID < Employee_name < Department
If it is possible to import excel data sheet empty table A that I have in the DB using a form of front-end APEX which is having a file navigation item only.
So, if I store that excel sheet using a navigation button in table wwv_flows_files, then automatically all means this sheet file data in the excellent flows_files table must be inserted into the table empty i have.
It is possible to store the data this way using a browse.
Brgds,
MiniHello
If you're on APEX 4.1 create data loading page. Then the end user may download the CSV data to your table.
Excel can be saved in CSV format.Kind regards
Jarihttp://dbswh.webhop.NET/dbswh/f?p=blog:Home:0
Importing data into tables to grant access (developer sql 3.2)
Hello
I want to import data into a table PAY_BALANCE_BATCH_LINES which is an array of interface. I am connected to a schema (APPS) and this table belongs to the HR schema. However, if you look at the grants, the APPS schema has all access to this particular table. A TOAD, this used to work great.
But in sqldeveloper, when I filter drop-down list of tables, I'm not able to find the table. Since it is my main means of downloading data I don't know how I can get access to download data in this table. I do not know the password for the schema HR incidentally.
Is there a way out?
Thank you very muchScroll to the bottom of the tree to the 'Other users' node, expand it, and then descend into HR > Tables. Then do your import.
To another browser, right-click on your connection in the tree and open a browser schema.
Generate the DDL - change is a new column and I want to generate an alter table.
All, morning
I searched and searched all over the Data Modeler and I can't find this option... but I found it easily in the designer.
I hope you can help me.
V3.0.0.665 SQL Developer Data Modeler.
I added a new column to a table, and when I generate the DDL I wish it were an alter table add column rather than a table to create.
This feature is in the designer, so I think it would be in the Data Modeler.
Just in case my description isn't clear, here are the high level steps, then it is clear.
1 create logic model
2. create the relational logic.
3. create the physical relationship.
4 generate the DDL and run in the database. At this point, I'm going to production with my system, and all right.
5. at this point, we have an enhancement request. For the model, it will be a new column in a table.
6. update of the logic model.
7. relational update logic
8 physical update of relational
9 generate the DDL. Here, I would have generate it know that it needs to generate an alter table add column and does not create the table.
This is something I do a lot as all my models are in production. I can't find how to do this step to get data Modeler to generate the altar.
Designer done exceptionally well.
Quite often, it is more than a single column. Changes can be many and made over time and at the time of generating the DDL you remember not every single amendment. To have the tool discover these changes for you and generate the appropriate DDL is a feature that I consider as very high.
I hope that is clear and you can help me.
See you soon
Chris...Hi Chris,
you need to compare your model on database - database relational model even import and use the option 'swap target' - in this case 'expressions of alter' against the database will be generated.
You can watch demonstrations here http://www.oracle.com/technetwork/developer-tools/datamodeler/demonstrations-224554.html
It would probably be more useful http://download.oracle.com/otn_hosted_doc/sqldev/importddl/importddl.html
Sooner or later your changes will require the table to be recreated, and you will need to backup your data - you can consider using the 'Advanced DDL' option - script is generated that will land your table content (including LOBs) to the system of files accessible from the database and restore after changes. Well not try directly on the production system :).Philippe
importing into a partitioned table of interval 11g
as I took export utility simple partition table 8i exp not rained so 100 k lines in there.
and imported with the import utility in the interval of 11g partitioned based on the date column.
There were imported, but did not what I expected...
If we execute the simple insert for partition interval 11g command, it create new partition automatically according to the strategy of partition.
Here's the demo...
created range partitioned table on the date with shift interval column...
CREATE TABLE TEST.xxx_HIST
(
xxx_DATE DATE NOT NULL,
P_ROLL_CONVENTION CHAR (2),
R_ROLL_CONVENTION CHAR (2),
P_COMPOUNDING_IND CHAR (2),
R_COMPOUNDING_IND CHAR (2),
P_CALC_METHOD CHAR (2),
R_CALC_METHOD CHAR (2),
P_SPREAD_AMT NUMBER (28,12).
R_SPREAD_AMT NUMBER (28,12).
)
partition by range (xxx_DATE)
interval (numtoyminterval(3,'MONTH'))
store (security)
(
values of pQ1 lower partition (to_date('2010-01-01','yyyy-mm-dd'))
) IN PARALLEL.
-IMPORTED FROM ROWS IN THE TABLE...
======================================================================
Connected to: Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT: V08.01.07 direct
CAUTION: objects have been exported by SYSTEM, not by you
. import of xx_ARCH in TEST objects
. . import of 141749 lines imported from the table 'xxx_HIST '.
Import completed successfully without warnings.
========================================================================
-HE HAS A LOT OF DATES OF DIFF IN THERE...
SQL > SELECT COUNT (DISTINCT xxx_DATE) TEST.xxx_HIST;
COUNT (DISTINCT xxx_DATE)
-----------------------------
1371
28-MARCH 06
10 FEBRUARY 06
9 FEBRUARY 05
20 FEBRUARY 02
3 JUNE 02
10 MAY 04
26 DECEMBER 03
31 JANUARY 03
xxx
---------
21 JULY 08
31 OCTOBER 05
25 APRIL 08
28 APRIL 08
12 OCTOBER 06
DECEMBER 21 07
28 DECEMBER 04
-BUT STILL ALL DUMPED INTO A PARTITION
SQL > SELECT nom_partition FROM DBA_TAB_PARTITIONS WHERE TABLE_OWNER = 'TEST ';
NOM_PARTITION
------------------------------
PQ1
It all dumped in a partition...
fact partition interval 11g creates the partition automatically in function whose lines if imported... when we import lines in there...? or am I missing something?
any idea guys?Seems to be a poor strategy for me because if I am not mistaken, there is no way to specify the order of the imported lines. If you import a line with the date max as your first row... bang, you get a range partition created for you and the rest falling.
I think you'd be better import these data into a table in step and then by a
insert into new_fancy_partition_table select * from old_8_temporary_imported_table order by date_column asc
Or create the partitions manually.
I just realized that you specify a partition in your create table statement (missed that on cursory inspection). And I think you misunderstand how the interval works... it's for values LARGER than the existing partitions ONLY...
http://download.Oracle.com/docs/CD/E11882_01/server.112/e10592/statements_7002.htm#SQLRF01402
"
INTERVAL clauseUse this clause to set the interval of partitioning the table. Range partitions are partitions based on a digital range interval or datetime. * They extend from range partitioning by commanding the database to automatically create partitions of the specified range or interval when the data inserted in the table exceed all the partitions.* range
"Published by: Tubby on August 16, 2010 18:32
Additional document link.
a simple way to insert data in a table
Hello
I need to know in a simple way on how to transfer data from one table to the other...
First xx_inv_tab1 table has three columns col1, col2, col3 and where as the second xx_inv_tab2 table has five columns col1, col2, col3, col4 col5.
Here col2, col3, col4 are the same columns in table1 xx_inv_tab1...
Now I want to transfer the first data in table in second table... first column of the second table holds a sequence, followed by the first three columns of table data and followed with col4 col5 which will contain NULL values...
In my scenario, I have 70-75 columns in my first table that I want to move to the second table including three new columns (one is the sequence with two other null values)...
All ideas, if do us it in a simpler way, saying rather insert into xx_inv_tab2 (col1, col2, col3, col75) values (seq, col1, col2,... col75, null, null)
Help appreciated...
Thank youEasy
not tested
insert into xx_inv_tab2 t2 (col1,col2,col3,col4) select yourSequence.nextval, t1.col1, t1.col2, t1.col3 from xx_inv_tab1 t1 ;
Note that col5 must not be used, since you want to fill with a NULL value.
Use excel or sql developer write you a list of the column names, if you are lazy to write all the columns of 75 by yourself.
Which might also work:
not tested
insert into xx_inv_tab2 t2 select yourSequence.nextval, t1.*, null from xx_inv_tab1 t1 ;
Published by: Sven w. on August 31, 2012 16:41
Maybe you are looking for
-
Need Skype like app with auto answer for 10.4.11
I need to be able to connect to an old iMac running 10.4.11 with a video-chat application (of a 10.8.5 computer) to keep an eye on things at home, so I would like to have an auto-reply function. Skype does not work on this OS. any ideas?
-
Routers are supported by the Time Machine feature?
Hello! I am looking for a router that supports the feature Time Machine for someone else. Now, I know that the Nighthawk R7000 router doing since I was able to find a tutorial on the Internet. The X 6 as R8000 is apparently too much. Is there a list
-
QVariantList gives QString int not
Hey there You have a problem with my QVariantList. When I do QSettings settings(author, appName); if(settings.value("days").isNull()) { QVariantList list; for(int i = 1; i < 6; i++) list.append(i); settings.setValue("days", list); } qDebug()
-
I'm on 11 GR 2 - lack of databases on virtual machines. There are 8 wires of CPU / DB Rac node. And there are 2 RAC nodes.We have ETL work that has a very long query duration. SQL Setup advise the active parallel profile and when I activated the para
-
Hello!We anticipate using (BOGO) promotion in Advanced Pricing in our requirement business in sales. My question is can I define a free item in Promotion in which the unit price in the price list is using formula? Here is an example of our business r