Re createing the control file
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?
Similar Messages
-
Regarding RESETLOG and NORESETLOG option while creating a control file
Hi,
I dont understand the need for resetlogs option while creating a controlfile for a db in NOARCHIVELOGMODE. I assume that reset logs clears all the redo log contents.
While taking a cold backup what I did was:
1. Shutdown instance
2. Copy all the files
3. Startup
Now I tried recovering the same database on a new machine (with different path btw.) coz of which i had to create a new control file. My question is: while restoring the database, do I need to create the control file with NORESETLOG or RESETLOG option?
When I tried using the NORESETLOG (NOARCHIVELOG) option I was able to recover the instance without any hassles.
ie
1. STARTUP NOMOUNT
2. CREATE NEW CONTROL FILE USING NORESETLOG (NOARCHIVELOG)
3. RECOVER DATABASE
4. ALTER DATABASE OPEN;
While the same thing with NORESETLOG (NOARCHIVELOG) option:
1. STARTUP NOMOUNT
2. CREATE NEW CONTROL FILE USING RESETLOG (NOARCHIVELOG)
3. RECOVER DATABASE USING BACKUP CONTROLFILE
This step asked me for some archivelogs which were not generated since the db is in NOARCHIVELOG mode.
I wonder why we require the RESETLOG OPTION SINCE A NORMAL SHUTDOWN PERFORMED BEFORE COLD BACKUP would have ensured that there is no redo information left in the redo logs.
Please let me know if I am thinking the incorrect way.
Regards and Thanx in Advance,
RajIf you had a db running in noarchivelog mode and had to clone the db and rename it, the create controlfile stmt:
create controlfile reuse <db_name> needs to be changed to: create controlfile SET <db_name>, in which case the db can only be opened with resetlogs. Hope this answers your question -
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 -
How to dynamically create sqlldr control file using stored procedure
I am trying to dynamically create the control file (.ctl) and execute the same using a stored procedure.I would be passing the file name as a parameter to this procedure. How do I go about doing this?
The control file has the following structure. The file name (mktg) varies and is passed as an input to the stored procedure.
SPOOL mktg.ctl
LOAD DATA
INFILE 'mktg.csv'
INTO TABLE staging
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(COMPANY_NAME,
ADDRESS,
CITY,
STATE,
ZIP)
SPOOL OFF ;
sqlldr scott/tiger CONTROL= mktg.ctl LOG=mktg.log BAD=mktg.badWe are using oracle 9i rel 2.
I have not had much success with the creation of log and bad files using external tables when they are being used within a dynamic sql.
Plz check this:
Re: problems related to data loads from excel, CSV files into an oracle 9i db -
VDBench failed to delete the control file
Seems like there were several file in the directory which did not belong to VDbench, but usually it fails when it tries to delete the directory it self, and not the control-file
Any ideas why this happened?
Thanks !
06:38:13.003 Starting RD=format_for_rd1
06:38:13.045 06:38:13.045 task_run_all(): 369 tasks
06:38:13.087 06:38:13.087 readDirsAndDelete(): Invalid file name found and not deleted: /mnt/sys--6/rickfs002 kuku
06:38:13.088 06:38:13.088 readDirsAndDelete(): Invalid file name found and not deleted: /mnt/sys--6/rickfs002 kuku
06:38:13.106 06:38:13.106 Message to master: anchor=/mnt/sys--2/clone001_snap001_rickfs003 deleted 12 directories; 631/sec
06:38:13.110 06:38:13.109 readDirsAndDelete(): Invalid file name found and not deleted: /mnt/sys--4/rickfs002 kuku
06:38:13.110 06:38:13.109 readDirsAndDelete(): Invalid file name found and not deleted: /mnt/sys--2/rickfs002 kuku
06:38:13.110 06:38:13.110 readDirsAndDelete(): Invalid file name found and not deleted: /mnt/sys--4/rickfs002 kuku
06:38:13.126 06:38:13.126 readDirsAndDelete(): Invalid file name found and not deleted: /mnt/sys--5/rickfs002 kuku
06:38:13.126 06:38:13.126
06:38:13.126 06:38:13.126 Unable to delete control file: /mnt/sys--4/clone001_snap001_rickfs004/vdb_control.file
06:38:13.127 06:38:13.126
06:38:13.127 java.lang.RuntimeException: Unable to delete control file: /mnt/sys--4/clone001_snap001_rickfs004/vdb_control.file
06:38:13.127 at Vdb.common.failure(common.java:308)
06:38:13.127 at Vdb.FileAnchor.deleteOldStuff(FileAnchor.java:805)
06:38:13.127 at Vdb.FileAnchor.cleanupOldFiles(FileAnchor.java:754)
06:38:13.128 at Vdb.FwgThread.run(FwgThread.java:137)A few thoughts:
- you have an other Vdbench test running against the same FSD anchor, though if I am not mistaken, Unix allows you to delete a busy file.
- you created the control file with different user/authorization.
Henk. -
Is it possible to create a control file without the datafiles
Hi All,
Is it possible to create a control file without the datafiles?
on any OS or DB version
regards,
sachinif I understand properly:
- you have a script to recreate the controlfile
- you have all of your database files backed up except your controlfiles
This should work as this is how we sometimes refresh dev databases:
1) restore the copies of the database files
2) recreate the controlfile
3) recover the database files to the desired point in time (if hot backup or archivelogs are available, otherwise, it would be as of the time of the backup)
4) add temp files to temporary tablespace(s)
The simpler solution would be to backup your controlfile at the same time as your datafiles (RMAN or o/s copy).
I hope I understood your question properly. -
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 -
I have a question about creating another control file. If I want to create another control file, do I need to put the values/paths of the current control files in the CREATE CONTROLFILE statement?
996403 wrote:
If I am wanting to create a new control file, do you recommend:
1. Use the Create Control file statementWhen to Create New Control Files:
All control files for the database have been permanently damaged/missing and you do not have a control file backup.
You want to change one of the permanent database parameter settings originally specified in the CREATE DATABASE statement.
These settings include the database name and the following parameters: MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES, and MAXINSTANCES.
For example, you would change a database name if it conflicted with another database name in a distributed environment,
or you would change the value of MAXLOGFILES if the original setting is too low.
2. Copy an existing control file and then edit the parameter file?i will recommend 2nd (if you have healthy control file) if you want multiplex control files. -
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 -
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,
MihaelaHere 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 -
How to make the control file consistent when I re-mulitplexing them
Oracle 10g R2 on the AIX 5.3L
My current control files (three) from the default set-up are all located in the same directory (/dbbaan/oradata/<SID>/). If I want to change some of the multiplexing of the control file to different directory to avoid the media failure,
1. I copy one or two control files to different directory.
2. create a new init_sid.ora from spfile
2. edit the init_sid.ora file and change the locations of the control file
3. shutdown/restart the DB using the init_sid.ora.
4. create the spfile from the pfile
5 shutdown/restart the DB with new spfile ( "SQL> startup")
My question is: since there is always time lag between copying and recreating the new init_sid.ora, while the control file(s) are constantly updating, how can Db guarrente the consistency of the DB when I restart the DB (the control file specified in the init_sid.ora may be some time old) ? or does it matter?
I did above and my DB restart without problem.Another problem concerns me. What happen if one of
multiplexed control file location, which I use a NFS
of another server, goes down and is not available
during the operation ( After I restart up the DB)? I
am sure I will see the error of that control file in
the alert log.If one of the control files not accessible during operation, Oracle will crash. So you better make sure all of your control file location are reliable and accessible. -
CREATE DATABASE cannot create a control file
I know, it's not supported. Please refrain from reminding me.
I am trying to install a second database on an Oracle 8i installation (8.1.7.4) on a Windows 2003 server. I cannot use DBCA because it doesn't work, so I create the databases manually using the script produced by DBCA.
So I run the following:
connect INTERNAL@TEST
startup nomount pfile="C:\oracle\admin\COHPTEST\pfile\initTEST.ora"
CREATE DATABASE TEST
LOGFILE 'D:\oracle\oradata\TEST\redo01.log' SIZE 1024K,
'D:\oracle\oradata\TEST\redo02.log' SIZE 1024K,
'D:\oracle\oradata\TEST\redo03.log' SIZE 1024K
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXLOGHISTORY 1
DATAFILE 'D:\oracle\oradata\TEST\system01.dbf' SIZE 264M REUSE AUTOEXTEND ON NEXT 10240K
MAXDATAFILES 254
MAXINSTANCES 1
CHARACTER SET WE8ISO8859P1
NATIONAL CHARACTER SET WE8ISO8859P1;
I receive the following error:
ORA-01501: CREATE DATABASE failed
ORA-00200: controlfile could not be created
ORA-00202: controlfile: 'D:\oracle\oradata\TEST\ctrl01.ctl'
ORA-27040: skgfrcre: create error, unable to create file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.
More information:
1) Added the "Everyone" account to full control on the D: drive, to eliminate the possibility of access issues.
2) The control files, the alertLog, and just about every other file do not exist before, or after the error.
3) I cannot produce more detailed information other than what you see. I do not know of a trace that will track this, which would be helpful.
4) I've tried from both SQLPLUS and SVRMGRL, as well as using INTERNAL, SYS accounts as well as adding sysdba privileges.
I would love to upgrade this instance, but it has other databases on it, and only one box to run this DB on.
SO, just to be sure, telling me to upgrade isn't what I am hoping to learn. I would appreciate some insight on how to display the account svrmgrl runs under, or how to get it to run under another user ID that would be great, or why it can't create the file, or a manual way to create the file (CREATE CONTROLFILE is for existing db's only right? )Hello, my name is stupid.
I was using a remote file in my TNS_ADMIN environment value. It was pointing to the old database the whole time. The old database was up and down all day, but no one was on it to notice.
Answer: Please check your TNS_ADMIN file, to make sure that you do not have any naming conflicts with the database you are creating, and another database with the same name in your collection of databases.
What happened:
The reason it could not create the files: There was another TEST database, which was what was connected to, and I tried to create the files on another server which did not have a D: Drive.
When I switched to C: it stated the files were already in existence, which I knew wasn't true, and what led me to look at what I was connecting to.
When I checked my TNSNames.Ora file, I noticed the 2nd entry for a database also named "TEST" that a previous DBA had left in there, I realized I was working on the wrong database because it connected to the first database in the TNSNames listed for that SID.
I removed the entry from the TNSNames file, and the database was created successfully (Manually, DBCA still doesn't work).
Thanks for all that tried to help, but introspection was the only solution. -
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;
+}+ -
If it is not specified,Oracle creates one control file in a default locatio
Hi
The CONTROL_FILES parameter is not required when you create a database. If it is not specified,Oracle creates one control file in a default location,.
Where oracle create contol file default in this condition
ThanksCan you try to create a database and see
FYI
It creates in $ORACLE_HOME\database folder..if not specified but in UNIX i think it will be under $ORACLE_HOME/dbs
Because i dont have UNIX right now to test it
Message was edited by:
Maran Viswarayar -
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
Maybe you are looking for
-
I bought an ipod nano for my wife for Christmas and added music to it from my library. She now wants to add some of her music from her library on her mac. How can we do this??
-
I have used my older Mac Pro and now my new 2011 iMac fo play the many movies and TV shows I have dowloaded. Great results. But I also have a lot of Blu Ray disks. I am going to load windows 7 via Boot Camp for other reasns. After that is done, and e
-
Import file name - want to go back to 2008-02-22 format HELP!
iphoto 06 imported photos into a date formatted file such as 2008-02-22. iphoto 08 makes this -February 22, 2008. I need help in just returning to the original date format as a default process. yes, I can do this manually but this requires additional
-
Some quick question for solution manager in 2 system landscape
First of all is there any way to not implement Solution manager but to still be able to patch the system.? i really need it only for this. If there is no way to avoid the solution manager, tell me is the saprouter the only way for connection to SAP f
-
Any ideas as to why my Iphone 4s' screen turns on and then off at random while just sitting next to me?