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!
Kevin
As 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!)
;)
Similar Messages
-
How to refer the SQL*Loader command line parameters in the control file
The problem I am trying to resolve is to insert the input file name when SQL*Loader is loading the record from the file. I have multiple files to load and it is nice to associate a record with a particular input file.
Create the control file dynamically (and fill one of the columns with the file name as a constant) before you start SQL*Loader
Another option is to use external tables
Re: Data Loading
Message was edited by:
Jens Petersen -
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 and foreign characters in the data file problem
Hello,
I have run into an issue which I can't find an answer for. When I run SQL Loader, one of my control files is used to get file content (LOBFILE) and one of the fields in the data file has a path to that file. The control file looks like:
LOAD DATA
INFILE 'PLACE_HOLDER.dat'
INTO TABLE iceberg.rpt_document_core APPEND
FIELDS TERMINATED BY ','
doc_core_id "iceberg.seq_rpt_document_core.nextval",
-- created_date POSITION(1) date "yyyy-mm-dd:hh24:mi:ss",
created_date date "yyyy-mm-dd:hh24:mi:ss",
document_size,
hash,
body_format,
is_generic_doc,
is_legacy_doc,
external_filename FILLER char(275) ENCLOSED by '"',
body LOBFILE(external_filename) terminated by EOF
A sample data file looks like:
0,2012-10-22:10:09:35,21,BB51344DD2127002118E286A197ECD4A,text,N,N,"E:\tmp\misc_files\index_testers\foreign\شیمیایی.txt"
0,2012-10-22:10:09:35,17,CF85BE76B1E20704180534E19D363CF8,text,N,N,"E:\tmp\misc_files\index_testers\foreign\ลอบวางระเบิด.txt"
0,2012-10-22:10:09:35,23552,47DB382558D69F170227AA18179FD0F0,binary,N,N,"E:\tmp\misc_files\index_testers\foreign\leesburgis_á_ñ_é_í_ó_ú_¿_¡_ü_99.doc"
0,2012-10-22:10:09:35,17,83FCA0377445B60CE422DE8994900A79,binary,N,N,"E:\tmp\misc_files\index_testers\foreign\làm thế nào bạn làm ngày hôm nay"
The problem is that whan I run this, SQL Loader throws an error that it can't find the file. It appears that it can't interpret the foreign characters in a way that allows it to find that path. I have tried adding a CHARACTERSET (using AL32UTF8 or UTF8) value in the control file but that only has some success with Western languages, not the ones listed above. Also, there is no set of defined languages that could be found in the data file. It essentaially could be any language.
Does anyone know if there is a way to somehow get SQL Loader to "understand" the file system paths when a folder and/or file name could be in some other langauge?
Thanks for any thoughts - PeterThanks for the reply Harry. If I try to open the file in various text editors like Wordpad, Notepad, GVIM, andTextpad, they all display the foreign characters differently. Only Notepad comes close to displaying the characters properly. I have a C# app that will read the file and display the contents and it renders it fine. If you look at the directory of files in Windows Explorer, they all are displayed properly. So it seems things like .Net and Windows have some mechanism to understand the characters in order to render them properly. Other applications, again like Wordpad, do not know how to render them properly. It would seem that whatever SQL Loader is using to "read" the data files also is not rendering the characters properly which prevents it from finding the directory path to the file. If I add "CHARACTERSET AL32UTF8" in the control file, all is fine when dealing with Western langauges (ex, German, Spanish) but not for the Eastern languages (ex. Thai, Chinese). So .... telling SQL Loader to use a characterset seems to work, but not in all cases. The AL32UTF8 is the characterset that the Oracle database was created with. I have not had any luck if I try to set the CHARACTERSET to whatever the Thai character set is, for example. There problem there though is that even if that did work, I can't target specific lagauages because the data could come from anywhere. It's like I need some sort of global "super set" characterset to use. It seems like the CHARACTERSET is the right track to follow but I am not sure, and even if it is, is there a way to handle all languages.
Thanks - Peter -
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 -
Help for: ORA-01103: database name PRIMARY in control file is not STANDBY
Hello all, this will be my first post to the support forum. I'm an associate dba with just 6 months on the job, so if I've forgotten something or not given some infromation that is needed please let me know.
I've also combed the forums/internet, and some of the answers haven't helped. The Oracle Document ORA-1103 While Mounting the Database Using PFILE [ID 237073.1] says my init.ora file is corrupted, but creating a new init.ora file from the spfile does not help. Neither does just starting from the spfile. I have older copies of the init.ora file and the spfiles that the database was running on previously, so I believe they are good.
This standby NIRNASD1 has existed previously, I had to refresh the primary NIKNASD2, and then re-instantiate NIRNASD1 after the refresh is complete.
My env is set correctly, and my ORACLE_SID has been exported to NIRNASD1
NIKNASD2 = Primary Database
NIRNASD1 = Secondary/Standby Database
Goal: Creation of Logical Standby NIRNASD1 after creating Physical Standby from NIKNASD2
My database versions are 10.2.0.4.0, and the databases are on a Unix server. Both databases are located on separate servers.
Steps that I have taken:
I used RMAN to backup our primary database to the staging area:
$ rman target /
run {
backup database
format '/datatransa/dg_stage/%U'
include current controlfile for standby;
sql "alter system archive log current";
backup archivelog all format '/datatransa/dg_stage/%U';
I used RMAN to Create Secondary Database utilizing RMAN DUPLICATE command.
RMAN> run {
2> allocate auxiliary channel auxdisk device type disk;
3> duplicate target database for standby NOFILENAMECHECK;
4> }
On Secondary database I started Managed Recovery mode
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
(I used pfile here, thinking that I needed to mount the database to the pfile so that the database would see the change in the dataguard parameters in the init.ora file, the change from logical to physical- I commeneted out the logical and uncommented the physical line)
# Dataguard Parameters
For logical standby, change db_name to name of standby database.
db_name=NIKNASD2 ### for physical, db_name is same as primary
#db_name=NIRNASD1 ### for logical, db_name is same as unique_name
SQL> STARTUP MOUNT PFILE = /oraa/app/oracle/product/1020/admin/NIRNASD1/pfile/initNIRNASD1.ora;
ORACLE instance started.
Total System Global Area 1577058304 bytes
Fixed Size 2084368 bytes
Variable Size 385876464 bytes
Database Buffers 1174405120 bytes
Redo Buffers 14692352 bytes
Database mounted.
SQL> ALTER DATABASE recover managed standby database using current logfile disconnect;
I then verified the Data Guard Configuration by using “alter system archive log current;” on the primary database and watching the sequence number change in the secondary database.
I made sure that:
• The primary database was in MAXIMUM PERFORMANCE MODE
• Stopped managed recover on the standby database: alter database recover managed standby database cancel;
• Built a logical standby data dictionary on the primary database
• The db_name in init.ora was changed (this is in our document at my job)
• I changed my database name (from physical to logical) in my init.ora pfile (reverse of what I did above)
# Dataguard Parameters
For logical standby, change db_name to name of standby database.
#db_name=NIKNASD2 ### for physical, db_name is same as primary
db_name=NIRNASD1 ### for logical, db_name is same as unique_name
I then went to shutdown my standby database and re-start it in a mount exclusive state, which is where I get the ORA-01103 Error (Again I used the pfile, thinking that I needed to tell the database it is now a logical standby):
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP EXCLUSIVE MOUNT PFILE = /oraa/app/oracle/product/1020/admin/NIRNASD1/pfile/initNIRNASD1.ora;
ORACLE instance started.
Total System Global Area 1577058304 bytes
Fixed Size 2084368 bytes
Variable Size 385876464 bytes
Database Buffers 1174405120 bytes
Redo Buffers 14692352 bytes
ORA-01103: database name 'NIKNASD2' in control file is not 'NIRNASD1'
From what I understand of the process, the name in the control file is correct, I want it to be NIRNASD1. But the database for some reason thinks it should be NIKNASD2. The following are the parts of my init.ora file that include the dataguard parameters:
# Database Identification
db_domain=""
#db_name=NIRNASD1
#db_unique_name=NIRNASD1
# File Configuration
control_files=("/oradba2/oradata/NIRNASD1/control01.ctl", "/oradba3/oradata/NIRNASD1/control02.ctl", "/oradba4/oradata/NIRNASD1/control03.ctl")
# Instance Identification
instance_name=NIRNASD1
# Dataguard Parameters
#db_name=NIKNASD2 ### for physical, db_name is same as prmary
db_name=NIRNASD1 ### for logical, db_name is same as unique_name
db_unique_name=NIRNASD1
dg_broker_start=TRUE
db_file_name_convert='NIKNASD2','NIRNASD1'
log_file_name_convert='NIKNASD2','NIRNASD1'
log_archive_config='dg_config=(NIRNASD1,NIKNASD2)'
log_archive_dest_1='LOCATION="/oraarcha/NIRNASD1/" valid_for=(ONLINE_LOGFILES,all_roles) db_unique_name=NIRNASD1'
#log_archive_dest_2='LOCATION="/oraarcha/NIKNASD2/" valid_for=(standby_logfiles,standby_roles) db_unique_name=NIRNASD1'
log_archive_dest_2='LOCATION="/oraarcha/NIKNASD2/" valid_for=(standby_logfile,standby_role) db_unique_name=NIRNASD1'
STANDBY_ARCHIVE_DEST='LOCATION=/oraarcha/NIKNASD2/'
# Parameters are not needed since this server will NOT become primary
#log_archive_dest_2='service=NIKNASD2
# valid_for=(online_logfiles,primary_role)
# db_unique_name=NIKNASD2'
fal_server='NIKNASD2'
fal_client='NIRNASD1'
I would appreciate any help, or pointing me in the right direction. I'm just missing something. I am reviewing the documents for building a physical and logical standby from oracle. Just not sure where to go from here.
Thank you
Edited by: 977917 on Dec 19, 2012 5:49 PMFirst of all, thank you both for answering my post. I've pulled up Mr. Hesse's page and will make it a go-to staple.
We're in the process of upgrading our databases, but we have 130+ databases and only six Oracle dba's, and I'm one of them. It's a large corporation, and things move at a "slow and tested" pace.
The pfile parameters listed above are from my secondary/standby database. And I do want to create a logical standby.
I forgot to mention that we do use DataGuard Broker, but I did not think that would be the cause of why the database was starting up incorrectly, so I did not mention it. My apologies there.
As far as the db_name, here's my question on that. It's my understanding the the db_name should be the name of the primary database when you are working with a physical standby, but as soon as you convert it to logical, you should change the db_name to the secondary/standby database? Am I correct on that?
Leading from that, during the process of creating the physical standby and converting the physical standby to the logical standby, should I change the db_name in the secondary/standby database in the spfile and never use the pfile at all? For instance, when I create the physical standby I have to change the db_name in the standby to the PRIMARY database, so that makes me think I should change db_name in the spfile? (If you see above, I changed db_name in the pfile and did a startup pfile)
This morning I was able to reach out to a fellow DBA (they are were asleep when I posted this last night), and they tried a few things. We had a redirect in the standby directory /oraa/app/oracle/product/1020/dbs folder that looked like this: spfileNIRNASD1.ora -> /oraa/app/oracle/product/1020/admin/NIRNASD1/pfile/spfileNIRNASD1.ora
She removed the redirect and the startup mount exclusive then worked without the error.
Thank you again for your help Mr.Quluzade and Mr. Hesse, I appreciate you all taking the time to teach someone new to the craft. I will definitely read up on the link that you sent me.
Chris Cranford -
Calling the function/procedure in the control file of the SQL*loader???
Hi,
Could you please let me know whether we can call procedure/function in the control file ? If possible, please share some examples.
Thanks in advance !!
Regards,
Vissu...Please see below code, I think It will help you...
LOAD DATA
INFILE 'mail_orders.txt'
BADFILE 'bad_orders.txt'
APPEND
INTO TABLE mailing_list
FIELDS TERMINATED BY ","
( addr,
city,
state,
zipcode,
mailing_addr EXPRESSION "Your_function(:mailing_addr)",
mailing_city EXPRESSION "UPPER(:mailing_city)",
mailing_state,
move_date EXPRESSION "substr(:move_date, 3, 2) || substr(:move_date, 7, 2)"
)Edited by: Atanu Chatterjee on Nov 12, 2010 2:44 AM -
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;
+}+ -
SQL loader for empty field at the end of the line
Hi,
I have following data file for sql loader. I am using Oracle 11.2. The table structure is table_a(id number, name varchar2(32), nbr number).
1, zzzz, 123
2, bbb,
3, ccc, 33
4, ddd,
Currently, I am using "TERMINATED BY ',' " in the control file for SQL loader. However row2 and row4 were thrown into the bad file. Any suggestion for me to load row2 and row4 into the table as well?
Thanks,Two of three columns in your table are named with reserved words.
My first suggestion is to run this query:
SELECT keyword
FROM v$reserved_words
ORDER BY 1;My second suggestion is that your read the FAQ and learn how to use tags to post listings to these forums so we can read what you post.
My third suggestion is that you go to my SQL*Loader Demos page of my website:
http://www.morganslibrary.org/reference/sqlloader.html
and look up "TRAILING NULLCOLS." -
Download Error - Contact customer support. Indesign wont load application have gone from the control panel. CS photoshop loads and wants a serial number - and my serial number dosent work?
Hello Bradley,
sometimes the "opm.db file" is the culprit. In this case you should delete it.
But as much as I regret it and as strange as it may seem I fear it's a challenge for Adobe's Creative Cloud Cleaner Tool.
Sometimes - for whatever reasons - CC doesn't "want" to work. In this case you should CC completely delete and reinstall by help of Adobe Creative Cloud Cleaner Tool. (A try to uninstall by own resources is not enough!)
I quote: ... helps resolve installation problems for Adobe Creative Cloud and Adobe Creative Suite (CS3-CS6) applications. The tool removes installation records for prerelease installations of Creative Cloud or Creative Suite applications. It does not affect existing installations of previous versions of Creative Cloud or Creative Suite applications.
Please use: http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html and follow the prescribed sequence of operations
If necessary and for further questions click through http://helpx.adobe.com/contact.html or http://helpx.adobe.com/de/contact.html and if "open" please use chat, I had the best experiences.
Good luck!
Hans-Günter -
How to pass parameters to the Control file while loading the data from flat file to staging table
Thanks in advance
Hi ,
LOADDATA statement is required at the beginning of the control file.
INFILE: INFILE keyword is used to specify location of the datafile or datafiles.
INFILE* specifies that the data is found in the control file and not in an external file. INFILE ‘$FILE’, can be used to send the filepath and filename as a parameter when registered as a concurrent program.
INFILE ‘/home/vision/kap/import2.csv’ specifies the filepath and the filename.
Hope this will help you...... -
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 -
11g Data Guard --ORA-01103: database name 'PRIM' in control file is not 'ST
Dear all,
From no mount stage i am trying to bring the db in mount stage in standby database
SQL> alter database mount standby database;
alter database mount standby database
ERROR at line 1:
ORA-01103: database name 'PRIM' in control file is not 'STANDBY'
What is this problem ?
I have taken standby control from from standby database and places with datafile's and removed the orginal control file. and added this standby.ora file in parameter file also (pfile).
the Primary database name is PRIM and standby database name is STANDBY.
This is my first time doing this data guard configuration kindly let me know what i have to do at this above mentioned stage ..
Regards
HamidStandby DB init file
prim.__db_cache_size=536870912
prim.__java_pool_size=8388608
prim.__large_pool_size=8388608
prim.__oracle_base='F:\standby'#ORACLE_BASE set from environment
prim.__pga_aggregate_target=520093696
prim.__sga_target=771751936
prim.__shared_io_pool_size=0
prim.__shared_pool_size=209715200
prim.__streams_pool_size=0
audit_file_dest='F:\standby\admin\standby\adump'
audit_trail='db'
compatible='11.2.0.0.0'
control_files='F:\standby\oradata\standby\STANDBY.ctl'
db_block_size=8192
db_domain='AKEETECH.COM'
db_name='prim'
db_recovery_file_dest='F:\standby\flash_recovery_area'
db_recovery_file_dest_size=4039114752
diagnostic_dest='F:\standby'
dispatchers='(PROTOCOL=TCP) (SERVICE=standbyXDB)'
fal_client='standby'
fal_server='prim'
local_listener='LISTENER_PRIM'
memory_target=1288699904
open_cursors=300
processes=150
remote_login_passwordfile='EXCLUSIVE'
standby_file_management='auto'
undo_tablespace='UNDOTBS1'
standby_file_management=auto
fal_server=prim
fal_client=standby
Primary Db Init file
prim.__db_cache_size=536870912
prim.__java_pool_size=8388608
prim.__large_pool_size=8388608
prim.__oracle_base='D:\Primary'#ORACLE_BASE set from environment
prim.__pga_aggregate_target=520093696
prim.__sga_target=771751936
prim.__shared_io_pool_size=0
prim.__shared_pool_size=209715200
prim.__streams_pool_size=0
*.audit_file_dest='D:\Primary\admin\prim\adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='D:\Primary\oradata\prim\control01.ctl','D:\Primary\flash_recovery_area\prim\control02.ctl'
*.db_block_size=8192
*.db_domain='AKEETECH.COM'
*.db_name='prim'
*.db_recovery_file_dest='D:\Primary\flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='D:\Primary'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=primXDB)'
*.local_listener='LISTENER_PRIM'
*.memory_target=1288699904
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
standby_file_management=auto
fal_server=prim
fal_client=standby
Steps i have followed till now.
1) Created standby control file in primary in mount stage (STANDBY.CTL)
2) Installed 11g DB software alone in standby location
3) Shutdown the Primary DB and Taken cold back of all the other files and copied in Standby DB location (Primary in D:\ Drive and Standby in F:\ Drive )
4) Edited init parameters in Primary and standby
5) Startup no mount pfile= standby db init file ( its started )
6) SQL> alter database mount standby database; --- at this time i got the error i have mentioned above, so i have changed the db_name same in both init.ora files
7)
Up to this step i have done .. but this is all blindly.. not in clear understanding..
Kindly guide me.. step by step configuration..
Regards
Hamid -
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
Maybe you are looking for
-
Itunes Match-original computer is no longer associated
I joined itunes match last spring, using my imac. Then I added my iphone and finally my ipad in July. I just got this message on my imac when I tried to sign to imatch: This computer is already associated with an Apple ID. You can use iTunes Match
-
How can I recover an itunes account balance that dissapeared when I updated my Ipod touch?
I tried using the express lane to get this question answered. when I finally got a hold of a real person they told me i had to send an email to someone else. but i never got the email address that i needed. any suggestions would be great thank you.
-
Certain resolutions make jobs fail w/ watermark on in Compressor 3
Compressor FCS3 on OSX 10.6.8 - turns out that certain frame sizes can prevent jobs from running along with a watermark filter. I had an H.264 setting with resize to 854x480 (essentially 480p 16:9 with square pixels). Whenever I tried to add a waterm
-
**RAN IPOD UPDATER 2005-11-17 WON'T RECOGNIZE MY IPOD**
I ran the latest updater on my fully charged monochrome screen IPOD 4?th generation and after it finished wiping my IPOD The IPOD is not recognized by the updater or the Systems software 2.0.1 install program. In the Windows task manager the IPODSERV
-
Dreamweaver CS6 will not start
I've had this problem for several weeks and thought I had it fixed by resetting the Preferences (http://helpx.adobe.com/dreamweaver/kb/restore-preferences-dreamweaver-cs4-cs5.html), however, my DCS6 application will not start again, and it seems to h