Database creation having a trace of the control file
Hi,
I want to move a database from one server let's say A to another server let's say B I have a copy of all the datafiles, redo logs, control files and init file of the database fron the server A. I have a trace of the control file.
I copied all these files on the server B in the location /dispecer_date/oradata, except init which is in ORACLE_HOME/dbs
I thought that the simplest method to recreate the database is from the backup of the control file writing in sql the command CREATE CONTROLFILE how is written in trace and replacing the word REUSE with the word SET in CREATE CONTROLFILE instruction.
I obtained an error:
ORA-01503: Create controlfile failed
ORA-01160: file is not a data file
ORA-01110: datafile: '/dispecer_date/oradata/system.dbf'
Why? The db_block_size parameter is 4096.
Thank you,
Mihaela
Here are the steps .....
sql > shutdown immediate ;
create identical dir structure on server b
copy all datafile,controlfile,redologfiles and pfile to target server ,And put them in same dir as of source.
now on taget server
sql > startup mountpfile = path of the pfile
sql > alter database opn
or
sql > alter database open resetlogs ;
this will do the trick, I don;t think recreating the controlfile is a good option hare , becuse you likly to loose some data if you stick on that one.
hare krishna
Alok
Similar Messages
-
Restore - filename for datafile is missing in the control file
I am practicing RMAN recovery procedures and I encountered a problem that I do not know how to solve.
1) I took a hot backup of my test database.
2) Create tablespace TS_DATA_TEMP
3) Deleted tablespace TS_DATA which had 2 datafiles
4) Created tablespace TS_DATA with 1 datafile
5) shutdown database
6) logged into RMAN in nomount
7) restore controlfile from autobackup;
8) alter database mount;
9) restore database;
RMAN> restore database;
Starting restore at 22-AUG-08
using channel ORA_DISK_1
the filename for datafile 5 is missing in the control file
skipping datafile 1; already restored to file /u02/oradata/EDM91/system01.dbf
skipping datafile 2; already restored to file /u02/oradata/EDM91/undotbs01.dbf
skipping datafile 6; already restored to file /u02/oradata/EDM91/index
skipping datafile 3; already restored to file /u02/oradata/EDM91/sysaux01.dbf
skipping datafile 7; already restored to file /u03/oradata/EDM91/TS_INDEX01.dbf
skipping datafile 9; already restored to file /u03/oradata/EDM91/TS_LOB01.dbf
skipping datafile 4; already restored to file /u02/oradata/EDM91/users01.dbf
restore not done; all files readonly, offline, or already restored
Finished restore at 22-AUG-08
10) tried to recover
Starting recover at 22-AUG-08
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/22/2008 15:04:22
RMAN-06094: datafile 5 must be restored
SQL> select name from v$datafile where file#=5;
NAME
/u04/oradata/EDM91/TS_DATA.dbf
12) alter database backup controlfile to trace
DATAFILE
'/u02/oradata/EDM91/system01.dbf',
'/u02/oradata/EDM91/undotbs01.dbf',
'/u02/oradata/EDM91/sysaux01.dbf',
'/u02/oradata/EDM91/users01.dbf',
'/u04/oradata/EDM91/TS_DATA.dbf',
'/u02/oradata/EDM91/index',
'/u03/oradata/EDM91/TS_INDEX01.dbf',
'/u04/oradata/EDM91/TS_DATA02.dbf',
'/u03/oradata/EDM91/TS_LOB01.dbf'
CHARACTER SET UTF8
So i'm not sure what the problem is. Datafile TS_DATA.dbf is located in the control file but i'm getting the error: the filename for datafile 5 is missing in the control file.
Suggestions on what's wrong with the control file?I found my mistake; a newbie error.
I did not know I needed to include in my restore command the 'until' option when doing incomplete recovery. I only included the 'until' option in the recover command:
original command
restore database;
recover database until sequence =123;
should be
restore database until sequence = 123;
recover database until sequence =123;
I usually run the command using a RUN block with a SET UNTIL SEQUENCE but this case I used the single commands separately.
RUN
+{+
SET UNTIL sequence 123;
RESTORE DATABASE;
RECOVER DATABASE;
+}+ -
alter database backup controlfile to trace;
How do I re create the control file using what's in trace(Oracle 9i Solaris 9)
Thanx.See Note 1012929.6 How to Recreate the Controlfile, the trace contains the syntax to recreate the controlfile, you can copy the contents to a sql file such as newctl.sql, edit the contents removing the header and make other changes such as increasing maxlogfiles, then run the sql file.
HTH
Enrique
PS Why do you need to rebuild the controlfile? -
Restore from OSB. RMAN-06024: no backup or copy of the control file found
I backed up controlfile for standby on production server to OSB media:
-bash-3.00$ rman target / catalog rman/rman@emgc
Recovery Manager: Release 10.2.0.5.0 - Production on Tue Jan 25 15:15:33 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: EMGC (DBID=1838014073)
connected to recovery catalog database
RMAN>
RMAN> CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
RUN
ALLOCATE CHANNEL ch1 DEVICE TYPE 'SBT_TAPE';
BACKUP CURRENT CONTROLFILE FOR STANDBY tag 'stb_ctl';
RELEASE CHANNEL ch1;
CONFIGURE DEVICE TYPE 'SBT_TAPE' CLEAR;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN> 2> 3> 4> 5> 6>
allocated channel: ch1
channel ch1: sid=1085 devtype=SBT_TAPE
channel ch1: Oracle Secure Backup
Starting backup at 25-JAN-11
channel ch1: starting compressed full datafile backupset
channel ch1: specifying datafile(s) in backupset
including standby control file in backupset
channel ch1: starting piece 1 at 25-JAN-11
channel ch1: finished piece 1 at 25-JAN-11
piece handle=1em30ngu_1_1 tag=STB_CTL comment=API Version 2.0,MMS Version 10.3.0.2
channel ch1: backup set complete, elapsed time: 00:00:27
Finished backup at 25-JAN-11
released channel: ch1
RMAN> list backup of controlfile;
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
1479 Full 512.00K SBT_TAPE 00:00:18 25-JAN-11
BP Key: 1480 Status: AVAILABLE Compressed: YES Tag: STB_CTL
Handle: 1em30ngu_1_1 Media: mf_rman-000003
Standby Control File Included: Ckp SCN: 33567224 Ckp time: 25-JAN-11
RMAN>
On standby server I try to restore this control file but there is some trouble with restore... By the way I can delete that backup piece...
-bash-3.00$ rman target / catalog rman/rman@emgc
Recovery Manager: Release 10.2.0.5.0 - Production on Tue Jan 25 15:34:32 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: emgc (not mounted)
connected to recovery catalog database
RMAN> set DBID=1838014073;
executing command: SET DBID
database name is "EMGC" and DBID is 1838014073
RMAN> RUN
ALLOCATE CHANNEL ch1 DEVICE TYPE 'SBT_TAPE';
crosscheck backup of controlfile;
2> 3> 4> 5>
allocated channel: ch1
channel ch1: sid=1093 devtype=SBT_TAPE
channel ch1: Oracle Secure Backup
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=1em30ngu_1_1 recid=40 stamp=741367328
Crosschecked 1 objects
released channel: ch1
RMAN> list backup of controlfile;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
1479 Full 512.00K SBT_TAPE 00:00:18 25-JAN-11
BP Key: 1480 Status: AVAILABLE Compressed: YES Tag: STB_CTL
Handle: 1em30ngu_1_1 Media: mf_rman-000003
Standby Control File Included: Ckp SCN: 33567224 Ckp time: 25-JAN-11
RMAN> RUN
ALLOCATE CHANNEL ch1 DEVICE TYPE 'SBT_TAPE';
RESTORE CONTROLFILE FROM TAG 'STB_CTL';
2> 3> 4> 5>
allocated channel: ch1
channel ch1: sid=1093 devtype=SBT_TAPE
channel ch1: Oracle Secure Backup
Starting restore at 25-JAN-11
released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/25/2011 15:35:20
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the control file found to restore
RMAN> RUN
ALLOCATE CHANNEL ch1 DEVICE TYPE 'SBT_TAPE';
delete noprompt backup of controlfile;
2> 3> 4> 5>
allocated channel: ch1
channel ch1: sid=1093 devtype=SBT_TAPE
channel ch1: Oracle Secure Backup
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
1480 1479 1 1 AVAILABLE SBT_TAPE 1em30ngu_1_1
deleted backup piece
backup piece handle=1em30ngu_1_1 recid=40 stamp=741367328
Deleted 1 objects
released channel: ch1
RMAN>You cannot specify a tag for a standby control file.
read here
http://download.oracle.com/docs/cd/B10501_01/server.920/a96566/rcmstand.htm#1002594
Edited by: Adigozalov Gurban on Jan 25, 2011 2:14 PM -
In case of a DB crash what happens to the status of the Control File
When a DB is crashed will the Control file that exists in the OS also get corrupted, What happens to the Data Files , how to recover the Control files and Data Files , the DB in case there isn't any Backup media or any Dump available on the DB.
The only one way to recover a database is to be in archivelog mode.
And if I said about recover stricto sensu, that's because even in noarchivelog mode we need to use the command recover until cancel before an open with resetlogs option, even if we haven't any redo/archive logs. That fake a recover, this is what we say a mimic recover. Which is not a recover stricto sensu like it can be the case with archivelog mode.
Nicolas. -
I can only backup the datafiles but not the control files and SPFiles
Hello, all,
I am using the Oracle 10g on a linux server which runs redhat 9. I want to backup the whole database to the disk, but not the flash recovery area. It is /rawdata. I will show how I configure the backup part in EM. Is there anything wrong?
1. the ARCHIVELOG is on
2. under Administration, in the All Initialization Parameters, I remove the string value of “log_archive_dest_1”. After that, I go to the SPFile and remove the string value of “log_archive_dest_1”
3. configure backup settings and policies. The Disk Backup Location field is set to /rawdata. Select Image Copy for Disk Backup type. Test Disk backup is successful.
4. go to Policy page. Select “Automatically backup the control file and server parameter file (SPFile) with every backup and database structural change.) input /rawdata into the filed: Autobackup Disk Location
Select “Optimize the whole database backup by skipping unchanged files such as read-only and offline datafiles that have been backed up”
Select “Retain backups that are necessary for a recovery to any time whin the specified number of days (point-in-time recovery)
Accept the default of 31days
5. go to Schedul Backup
6. select customized from the backup Strategy drop-down menu. Select the Whole Database
7. in the Options page, select “Full backup” in the Backup Type section. Select “Online Backup” in the Backup Mode section. Select “back up all archived logs on disk” in the Advanced section.
8. in the Setting page, select “Disk”
9. in the Schedule page, accept the default job name and description. Select Immediately to execute the job immediately.
10. just submit the job.
After several minutes, the job is failed while the Prebackup and Postbackup are succeeded. The log says:
Recovery Manager: Release 10.1.0.2.0 - Production
Copyright (c) 1995, 2004, Oracle. All rights reserved.
RMAN>
connected to target database: ORCL10G (DBID=770753237)
using target database controlfile instead of recovery catalog
RMAN>
Starting backup at 11-OCT-06
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=268 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=+DATADG/orcl10g/system01.dbf
output filename=/rawdata/data_D-ORCL10G_I-770753237_TS-SYSTEM_FNO-1_68hvin50 tag=BACKUP_ORCL10G_000_101106111844 recid=108 stamp=603544772
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=+DATADG/orcl10g/sysaux01.dbf
output filename=/rawdata/data_D-ORCL10G_I-770753237_TS-SYSAUX_FNO-3_69hvin6d tag=BACKUP_ORCL10G_000_101106111844 recid=109 stamp=603544813
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=+DATADG/orcl10g/example01.dbf
output filename=/rawdata/data_D-ORCL10G_I-770753237_TS-EXAMPLE_FNO-5_6ahvin7g tag=BACKUP_ORCL10G_000_101106111844 recid=110 stamp=603544829
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=+DATADG/orcl10g/undotbs01.dbf
output filename=/rawdata/data_D-ORCL10G_I-770753237_TS-UNDOTBS1_FNO-2_6bhvin7v tag=BACKUP_ORCL10G_000_101106111844 recid=111 stamp=603544835
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=+DATADG/orcl10g/users01.dbf
output filename=/rawdata/data_D-ORCL10G_I-770753237_TS-USERS_FNO-4_6chvin87 tag=BACKUP_ORCL10G_000_101106111844 recid=112 stamp=603544841
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 11-OCT-06
Starting Control File and SPFILE Autobackup at 11-OCT-06
piece handle=/rawdata/c-770753237-20061011-05 comment=NONE
Finished Control File and SPFILE Autobackup at 11-OCT-06
RMAN>
Starting backup at 11-OCT-06
current log archived
using channel ORA_DISK_1
archived log /rawdata/arch_D-ORCL10G_id-770753237_S-1062_T-1_A-586368151_cqhvf270 not found or out of sync with catalog
trying alternate file for archivelog thread 1, sequence 1062
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 10/11/2006 11:20:54
RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
ORA-19625: error identifying file /rawdata/arch_D-ORCL10G_id-770753237_S-1062_T-1_A-586368151_puhkv41f
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
RMAN>
Recovery Manager complete.
It seems the system tries to find a file “arch_D-ORCL10G_id-770753237_S-1062_T-1_A-586368151_cqhvf270” in /rawdata. I just can not understand.
What should I do? Any advice is highly appreciated!
Qianthe string value in the field of 'log_archive_dest_1" under "All Initialization parameters" is "LOCATION=+DATADG/orcl10g/". The same value was in the field under SPFile.
I reset these values and tried to backup the whole database. The same error appeared. The log says:
Recovery Manager: Release 10.1.0.2.0 - Production
Copyright (c) 1995, 2004, Oracle. All rights reserved.
RMAN>
connected to target database: ORCL10G (DBID=770753237)
using target database controlfile instead of recovery catalog
RMAN>
Starting backup at 11-OCT-06
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=245 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=+DATADG/orcl10g/system01.dbf
output filename=/rawdata/data_D-ORCL10G_I-770753237_TS-SYSTEM_FNO-1_6ghvj9rd tag=BACKUP_ORCL10G_000_101106043753 recid=114 stamp=603563922
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=+DATADG/orcl10g/sysaux01.dbf
output filename=/rawdata/data_D-ORCL10G_I-770753237_TS-SYSAUX_FNO-3_6hhvj9sq tag=BACKUP_ORCL10G_000_101106043753 recid=115 stamp=603563963
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=+DATADG/orcl10g/example01.dbf
output filename=/rawdata/data_D-ORCL10G_I-770753237_TS-EXAMPLE_FNO-5_6ihvj9tu tag=BACKUP_ORCL10G_000_101106043753 recid=116 stamp=603563977
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=+DATADG/orcl10g/undotbs01.dbf
output filename=/rawdata/data_D-ORCL10G_I-770753237_TS-UNDOTBS1_FNO-2_6jhvj9ud tag=BACKUP_ORCL10G_000_101106043753 recid=117 stamp=603563984
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=+DATADG/orcl10g/users01.dbf
output filename=/rawdata/data_D-ORCL10G_I-770753237_TS-USERS_FNO-4_6khvj9uk tag=BACKUP_ORCL10G_000_101106043753 recid=118 stamp=603563990
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 11-OCT-06
Starting Control File and SPFILE Autobackup at 11-OCT-06
piece handle=/rawdata/c-770753237-20061011-07 comment=NONE
Finished Control File and SPFILE Autobackup at 11-OCT-06
RMAN>
Starting backup at 11-OCT-06
current log archived
using channel ORA_DISK_1
archived log /rawdata/arch_D-ORCL10G_id-770753237_S-1062_T-1_A-586368151_cqhvf270 not found or out of sync with catalog
trying alternate file for archivelog thread 1, sequence 1062
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 10/11/2006 16:40:05
RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
ORA-19625: error identifying file /rawdata/arch_D-ORCL10G_id-770753237_S-1062_T-1_A-586368151_puhkv41f
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
RMAN>
Recovery Manager complete.
Why the system keeps trying to find files under /rawdata? It is the destination, not the source.
Any help is appreciated!
Qian
Message was edited by:
QianChen -
RMAN-06024: no backup or copy of the control file found to restore
I am cloning a new database using a full backup from previous nightly rman backup using a standby database utilizing catalog. When I run the duplicate command, I get
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/27/2011 15:04:05
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the control file found to restore
But the backup of controlfile does exists in the right place. What am I missing?958210 wrote:
i was trying to clone a database to a remote machine, but it is giving me the following error
'RMAN-06024: no backup or copy of the control file found to restore
ORA-19505: failed to identify file "/u01/app/oracle/product/11.2.0/dbs/c-1617115651-20120912-02"
even though i can list the backup of the control file in the source machine.
thank you
'How do I ask a question on the forums?
SQL and PL/SQL FAQ
Since we don't know what you did, so we can't know what you did wrong -
Different log file name in the Control file of SQL Loader
Dear all,
I get every day 3 log files with ftp from a Solaris Server to a Windows 2000 Server machine. In this Windows machine, we have an Oracle Database 9.2. These log files are in the following format: in<date>.log i.e. in20070429.log.
I would like to load this log file's data to an Oracle table every day and I would like to use SQL Loader for this job.
The problem is that the log file name is different every day.
How can I give this variable log file name in the Control file, which is used for the SQL Loader?
file.ctl
LOAD DATA
INFILE 'D:\gbal\in<date>.log'
APPEND INTO TABLE CHAT_SL
FIELDS TERMINATED BY WHITESPACE
TRAILING NULLCOLS
(SL1 DATE "Mon DD, YYYY HH:MI:SS FF3AM",
SL2 char,
SL3 DATE "Mon DD, YYYY HH:MI:SS FF3AM",
SL4 char,
SL5 char,
SL6 char,
SL7 char,
SL8 char,
SL9 char,
SL10 char,
SL11 char,
SL12 char,
SL13 char,
SL14 char,
SL15 char)
Do you have any better idea about this issue?
I thought of renaming the log file to an instant name, such as in.log, but how can I distinguish the desired log file, from the other two?
Thank you very much in advance.
Giorgos BaliotisI don't have a direct solution for your problem.
However if you invoke the SQL loader from an Oracle stored procedure, it is possible to dynamically set control\log file.
# Grant previleges to the user to execute command prompt statements
BEGIN
dbms_java.grant_permission('bc4186ol','java.io.FilePermission','C:\windows\system32\cmd.exe','execute');
END;
* Procedure to execute Operating system commands using PL\SQL(Oracle script making use of Java packages
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
import java.io.*;
public class Host {
public static void executeCommand(String command) {
try {
String[] finalCommand;
finalCommand = new String[4];
finalCommand[0] = "C:\\windows\\system32\\cmd.exe";
finalCommand[1] = "/y";
finalCommand[2] = "/c";
finalCommand[3] = command;
final Process pr = Runtime.getRuntime().exec(finalCommand);
new Thread(new Runnable() {
public void run() {
try {
BufferedReader br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String buff = null;
while ((buff = br_in.readLine()) != null) {
System.out.println("Process out :" + buff);
try {Thread.sleep(100); } catch(Exception e) {}
catch (IOException ioe) {
System.out.println("Exception caught printing process output.");
ioe.printStackTrace();
}).start();
new Thread(new Runnable() {
public void run() {
try {
BufferedReader br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
String buff = null;
while ((buff = br_err.readLine()) != null) {
System.out.println("Process err :" + buff);
try {Thread.sleep(100); } catch(Exception e) {}
catch (IOException ioe) {
System.out.println("Exception caught printing process error.");
ioe.printStackTrace();
}).start();
catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
public static boolean isWindows() {
if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
return true;
else
return false;
* Oracle wrapper to call the above procedure
CREATE OR REPLACE PROCEDURE Host_Command (p_command IN VARCHAR2)
AS LANGUAGE JAVA
NAME 'Host.executeCommand (java.lang.String)';
* Now invoke the procedure with an operating system command(Execyte SQL-loader)
* The execution of script would ensure the Prod mapping data file is loaded to PROD_5005_710_MAP table
* Change the control\log\discard\bad files as apropriate
BEGIN
Host_Command (p_command => 'sqlldr system/tiburon@orcl control=C:\anupama\emp_join'||1||'.ctl log=C:\anupama\ond_lists.log');
END;Does that help you?
Regards,
Bhagat -
SQL Loader: refer datafile name in the control file
Hi All:
Database: 10GR2
I have a table as following:
test (
filename varchar2(100),
mydata varchar2(1000)
I am using sql loader to populate data for this table. I also need store the datafile name to column test.filename as part of dataload. How to refer datafile name in the control file?
Again, I am processing multiple files in a batch mode. I need store datafile name in filename column so that I can know which "mydata" come from which datafile.
Thanks in advance!
KevinAs Bravid says, you can't do that from within SQL*Loader, unless the control files are dynamically generated by a script and the filename included as the default value for that particular column as a hardcoded literal.
It's easier if you use external tables as the table definition contains the "location" which is the list of filenames it is accessing, and the value can be queried as well as being dynamically changed (though if you're dynamically changing it, then you'll programatically know the filename anyway. hint hint!)
;) -
How to recreate the control files
Can someone tell me how to recreate the control file?
Thanks in advance
HimanshuHi, You can use the following statement.
CREATE CONTROLFILE
SET DATABASE prod
LOGFILE GROUP 1 ('/u01/oracle/prod/redo01_01.log',
'/u01/oracle/prod/redo01_02.log'),
GROUP 2 ('/u01/oracle/prod/redo02_01.log',
'/u01/oracle/prod/redo02_02.log'),
GROUP 3 ('/u01/oracle/prod/redo03_01.log',
'/u01/oracle/prod/redo03_02.log')
NORESETLOGS
DATAFILE '/u01/oracle/prod/system01.dbf' SIZE 3M,
'/u01/oracle/prod/rbs01.dbs' SIZE 5M,
'/u01/oracle/prod/users01.dbs' SIZE 5M,
'/u01/oracle/prod/temp01.dbs' SIZE 5M
MAXLOGFILES 50
MAXLOGMEMBERS 3
MAXLOGHISTORY 400
MAXDATAFILES 200
MAXINSTANCES 6
ARCHIVELOG;
Thanks -
Instances where the control file needs to be backed up
Oracle Version --> 11G
Control file needs to backed up
1. When you add or rename datafiles
2. Add or Drop redo log members
3. Dropping tablespaces
4. After any ALTER DATABASE commandAre there any more instances where we have to backup the control file?T.Boyd wrote:
Oracle Version --> 11G
Control file needs to backed up
1. When you add or rename datafiles
2. Add or Drop redo log members
3. Dropping tablespaces
4. After any ALTER DATABASE commandAre there any more instances where we have to backup the control file?Anything that actually updates the control file. like maybe taking a backup with rman?
"set controlfile autoback on" is your friend.
"set it and forget it." -
Relocate SYSTEM TS and edit the control file in oracle10g !
Friends ,
I want to change my SYSTEM and SYSAUX tablespace's lcation as well as rename the filename in oracle10g database . is it possible to do ?
And also I want to edit the control file and rebuild a new controlfile . is it possible ?
Plz inform me ....
Waiting for ur reply ......Here below I just rename the file (with host command line), but the Oracle commands are exactly same if you move the files.
SQL> select file_name from dba_data_files where tablespace_name in ('SYSTEM','SYSAUX');
FILE_NAME
/data/oracle/cdev10/system01.dbf
/data/oracle/cdev10/sysaux01.dbf
SQL> startup force mount
ORACLE instance started.
Total System Global Area 1002438656 bytes
Fixed Size 2088832 bytes
Variable Size 469762176 bytes
Database Buffers 507510784 bytes
Redo Buffers 23076864 bytes
Database mounted.
SQL> !mv /data/oracle/cdev10/system01.dbf /data/oracle/cdev10/system_01.dbf
SQL> !mv /data/oracle/cdev10/sysaux01.dbf /data/oracle/cdev10/sysaux_01.dbf
SQL> alter database rename file '/data/oracle/cdev10/system01.dbf' to '/data/oracle/cdev10/system_01.dbf';
Database altered.
SQL> alter database rename file '/data/oracle/cdev10/sysaux01.dbf' to '/data/oracle/cdev10/sysaux_01.dbf';
Database altered.
SQL> alter database open;
Database altered.
SQL> select file_name from dba_data_files where tablespace_name in ('SYSTEM','SYSAUX');
FILE_NAME
/data/oracle/cdev10/system_01.dbf
/data/oracle/cdev10/sysaux_01.dbf
SQL>What's the need to rebuild the ctlfile ?
Nicolas. -
Revision: 1267
Author: [email protected]
Date: 2008-04-16 17:02:53 -0700 (Wed, 16 Apr 2008)
Log Message:
fixed .patch creation to create patch with the selected files only, remove, fix newlines in the patch file.
Modified Paths:
flex/sdk/trunk/tools/diffpack/diffpack
flex/sdk/trunk/tools/diffpack/readme.txtAll,
I thought it may be related to spaces in the path in which the script was called from. I tried having the ODBC command script in another directory but the same thing happens. It will give me the "CONFIGSYSDSN: Unable to create a data source for the 'Oracle in OraClient10g_home1' driver: Could not load the setup or translator library with error code -2147467259". As soon as the script is done running I can manually double click the script and it adds the DSN fine.
Thanks,
Clif Bridegum -
How can i validate the data in the control file?
Consider that the SQLLoader reads the Input data File from the path and it loads the data into the tables based up on the descrition specified in the control File.
First, the table to be filled is created:
create table sql_loader_1 ( load_time date, field_1 Numeric, field_2 varchar2(10)
Sample Control File :
load_1.ctl
load data
infile 'load_1.dat' "str '\r\n'"
insert into table sql_loader_1
load_time sysdate,
field_2 position( 1:10),
field_1 position(11:20)
Note that the positions 11 through 20 are loaded into field_1 and positions 1 through 10 into field_2. The field load_time is filled with the current time (sysdate) of the load.
Here's the data. The name of the file (load_1.dat) had been specified with the infile statement in the control file.
load_1.dat
0123456789abcdefghij
foo bar
here comes a very long line
and the next is
short
Here i want to validate the field_1 (Numeric Datatype) since the data file contains the character value (i.e)abcdefghijGood question for this forum:
Export/Import/SQL Loader & External Tables
Werner -
Need help in writing the control file for SQLLOADER
Is it possible to error out the Sqlloader in case the data fields in the data file for a row are more than the fields stated in the control file?
i.e. My data file is something like
aaa,bbb,cc
dd,eee
And my ctl file has just 2 columns in it. Is it possible to write a control file which will cause the Sqlloader to error out?
Thanks...Nisha,
Again I posted test example in your other post but here is how can do that
CREATE TABLE mytest111 (
col1 NUMBER,
col2 NUMBER,
col3 NUMBER
LOAD DATA
TRUNCATE INTO TABLE MYTEST111
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
col1 integer external,
col2 integer external
#mytest.dat
1,2,3
1,2
SQL*Loader: Release 10.2.0.1.0 - Production on Fri Apr 10 11:40:39 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: mytest.ctl
Data File: mytest.dat
Bad File: mytest.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table USIUSER.MYTEST111, loaded from every logical record.
Insert option in effect for this table: TRUNCATE
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
COL1 FIRST * , O(") CHARACTER
COL2 NEXT * , O(") CHARACTER
Table MYTEST111:
2 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 33024 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 2
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Fri Apr 10 11:40:39 2009
Run ended on Fri Apr 10 11:40:40 2009
Elapsed time was: 00:00:00.99
CPU time was: 00:00:00.06
{code}
Regards
Maybe you are looking for
-
Downloading Reports from a Dashboard
In normal reports you have the option to download any report to excel for example. In a dashboard you only have the "Printer Friendly" option. I noticed in the pre-built dashboards that each individual report has a "download" feature, but when creati
-
Hi , Can anybody describe me the main difference between T code f.13 (automatic clearing without clearing currency) and F13E (automatic clearing with clearing currency). What is clearing currecy? Is it that if GR and IR in different currency you need
-
Receiver HTTP(S) connection
Scenario: IDOC-XI-HTTP(S) Can I do a HTTP(S) connection with Receiver comm channel ? I wan to do a secured HTTP post to the 3rd party.But When I try to create a 'Receiver' Comm channel, I only see Transport protocol of HTTP 1.0 and there is no option
-
JDeveloper 10.1.3.3 ADF Swing - Images not rendering after deployment
Hi, I have deployed my ADF Swing application in production in very simple 2 tiers architecture. One executal jar on my desktop and The database running on a Linux server. When I run MyApp.jar from my desktop, none of my images is rendered and LOV but
-
My iphone 4s saw could not activate
this iphone 4s......i unlock alrd now still cannot activate pls help MODEL: IPHONE 4S 16GB WHITE SERIAL: DN*******TD0 iOS: 6.1.3 MAC Address: 4CB199F00000 Network Unlocked: False Activation Status: No Original Carrier: Unlock (Connect to Itunes) Appl