Sqlloader control file when clause

Problem 1
Lets say, I have a table x with (f1 number(2), f2 varchar(14), f3 Number(1))
datafile1
10,ls
22,st
45,tanveer
77,cool
1,not cool
requirement is to insert the first 2 columns in f1 and f2 and insert 0 in f3 only
if f2 == tanveer
Problem 2
Table is y (f4 number (2), f5 varchar (16))
datafile2
ls,xxxx
tanveer,yyyy
cool,zzzz
not cool, mmmm
given the value of the first coloumn I would like to query table x
and find the corresponding value of f1 insert it to table y's column f4
and associated string to f5.
Please let me know how to write the control files for sqlloader.

Problem 1:
-- control file:
LOAD DATA
INFILE 'DATAFILE1.DAT'
APPEND
INTO TABLE x
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(f1, f2,
f3 "DECODE (:f2, 'tanveer', 0, NULL)")
Problem 2:
Create another table z,
load the data into z,
insert into y selecting
from join of x and z:
-- create staging table:
CREATE TABLE z
  (f6 VARCHAR2 (14),
   f7 VARCHAR2 (16));
-- control file:
LOAD DATA
INFILE 'DATFILE2.DAT'
APPEND
INTO TABLE z
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(f6, f7)
-- insert:
INSERT INTO y (f4, f5)
SELECT x.f1, z.f7
FROM   x, z
WHERE  z.f6 = x.f2;

Similar Messages

  • SQL Loader Control file WHEN clause

    LOAD DATA
    REPLACE
    INTO TABLE IDL_Investments
    WHEN average_balance < '100.00'
    FIELDS TERMINATED BY X'9'
    TRAILING NULLCOLS
    Borrower_Id,
    Account_No,
    customer_No,
    cptype_id "GETID(:cptype_id)",
    customer_name,
    average_balance,
    CP_GroupName,
    CP_type,
    Account_Type,
    Instrument_type,
    DD_date "TO_DATE(:DD_date, 'dd/mm/yy')",
    fac_Maturity_date "TO_DATE(:fac_Maturity_date, 'dd/mm/yy')"
    above one is the control file. when i tried to load data i waas getting the following error.
    SQL*Loader-350: Syntax error at line 4.
    Illegal combination of non-alphanumeric characters
    WHEN average_balance < '100.00'
    ^
    instead of '<' symbol if i place an '=' symbol then its workig fine.
    So how do I use <, <=, > or >= operators in a WHEN clause of a control file can any one help me?
    Thanks in advance.

    Thanks for the suggestion but by searching in someother sites i found that
    only equality operators ('=', '!=' or '<>') are permited in the WHEN clause expressions of a control file in SQL Loader.
    So now i changed my logic.
    thanks anyway.

  • Sqlloader:only 1st when clause works for comma separated data file

    LOAD DATA
    INFILE 'XXMI_SUPPLIER_DATA.dat'
    REPLACE
    INTO TABLE APPS.XXMI_AP_SUPPLIERS_STG
    when interface_record_type = '01'
    Fields terminated by "," Optionally enclosed by '"'
    TRAILING NULLCOLS
    and
    INTO TABLE APPS.XXMI_AP_SUPPLIER_SITES_STG
    when interface_record_type = '02'
    Fields terminated by "," Optionally enclosed by '"'
    TRAILING NULLCOLS
    always getting the error for second when clause:
    4 Rows not loaded because all WHEN clauses were failed.
    pls any one can throw some light on this?

    What's Oracle version.
    What's your datafile looks like. Post a few sample line here.
    when interface_record_type = '01'You didn't define interface_record_type in your when clause.
    Sample,
    INTO TABLE dept
       WHEN recid = 1
       (recid  FILLER INTEGER EXTERNAL TERMINATED BY WHITESPACE,
        deptno INTEGER EXTERNAL TERMINATED BY WHITESPACE,
        dname  CHAR TERMINATED BY WHITESPACE) check Oracle doc,
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1004788

  • Functioning of control file when re-created

    Hi friends,
    we can recover database without data loss when there is a situation to re-create control file(for suppose control file is lost and no multiplexed copies are available) using NORESETLOGS option in controlfile script.
    when we re-create controlfile, no SCN and checkpoint information will be there in controlfile. Then how controlfile will get the latest SCN and how it allows DB to be up and running.
    please explain. thanks in advance

    Hi,
    As per my knowledge I am explaning what will happen at Background.
    As you said that control File is lost and no mutiplexed, In that scenario you are going to recreate the Controlfile. As we know that control file will be in Sync with All DataFiles (System etc.,) , which will hold the SCN numbers, When the Instance is UP with the newly Created ControlFile (Since scn is not available), it will get the Highest SCN Number from Current DataFiles and Check for in Sync with other Datafiles, whether SCN is in Sync with the Other data files or not.
    And further proceed with Recovery Process Based on the Redo Logs.
    As you said if the required SCN is not available in the Redo Logs it will Check for the Archive Redo Logs Based on the SCN i.e., (If Req SCN is < SCN in Redo Logs) It will Check for Archive Logs files.
    Let me know in case If I am not clear or some where wrong in concept so that I can learn some thing inturn from others.!!
    Thanks & Regards,
    Pavan Kumar N

  • Problem in identifying control file when creating physical standby

    hi there,
    (database version: 10.2.0.4
    plateform linux)
    I'm using the command as below to create physical standby database from backup:
    rman target / auxiliary sys/tiger@paceview
    Recovery Manager: Release 10.2.0.4.0 - Production on Tue Sep 4 18:05:53 2012
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    connected to target database: PACEVIEW (DBID=2092349485)
    connected to auxiliary database: PACEVIEW (not mounted)
    run {
    allocate auxiliary channel c1 device type DISK;
    set until sequence 38;
    duplicate target database for standby dorecover nofilenamecheck;
    released channel: ORA_DISK_1
    allocated channel: c1
    channel c1: sid=35 devtype=DISK
    allocated channel: c2
    channel c2: sid=36 devtype=DISK
    executing command: SET until clause
    Starting Duplicate Db at 04-SEP-12
    contents of Memory Script:
       set until scn  138180211934;
       restore clone standby controlfile;
       sql clone 'alter database mount standby database';
    executing Memory Script
    executing command: SET until clause
    Starting restore at 04-SEP-12
    channel c1: restoring control file
    ORA-19625: error identifying file /backup/rman/paceview/DEL1_standby.ctl
    ORA-27037: unable to obtain file status
    Linux-x86_64 Error: 2: No such file or directory
    Additional information: 3
    ORA-19600: input file is control file  (/backup/rman/paceview/DEL1_standby.ctl)
    ORA-19601: output file is control file  (/PGHProdDB/oradata/paceview/control1.ctl)
    failover to previous backup
    released channel: c1
    released channel: c2
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 09/04/2012 18:01:44
    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 restorei have already tried crosscheck but still giving same error
    thanks

    Hello;
    So this is what I would do :
    Backup Primary ( change to your directory as need )
    RMAN RUN {
    allocate channel d1 type disk;
    backup format '/u01/backups/PRIMARY/df_t%t_s%s_p%p' database;
    sql 'alter system archive log current';
    backup format '/u01/backups/PRIMARY/al_t%t_s%s_p%p' archivelog all;
    backup current controlfile for standby format '/u01/backups/PRIMARY/sb_t%t_s%s_p%p';
    release channel d1;
    }Move the backup and duplicate like this :
    rman target sys/password@PRIMARY auxiliary /
    RMAN> run {
    allocate channel C1 device type disk;
    allocate auxiliary channel C2 device type disk;
    duplicate target database for standby nofilenamecheck;
    }For complete details of this method see :
    http://www.visi.com/~mseberg/duprman2.html
    Best Regards
    mseberg

  • Who will update control file when renaming a redolog file

    Hi when we rename a redolog file in mount state of database using the following command
    ALTER DATABASE
    RENAME FILE '/diska/logs/log1a.rdo', '/diska/logs/log2a.rdo'
    TO '/diskc/logs/log1c.rdo', '/diskc/logs/log2c.rdo';
    how the new location and new name of redo log files will be updated to control file and who will update that inforamtion
    thanks in advance.

    Where did you get this?
    oracle    4774  4733  0 12:04 pts/0    00:00:00 sqlplus   as sysdba
    oracle    4797     1  0 12:04 ?        00:00:00 ora_pmon_DB1
    oracle    4799     1  0 12:04 ?        00:00:00 ora_vktm_DB1
    oracle    4803     1  0 12:04 ?        00:00:00 ora_diag_DB1
    oracle    4805     1  0 12:04 ?        00:00:00 ora_dbrm_DB1
    oracle    4807     1  0 12:04 ?        00:00:00 ora_psp0_DB1
    oracle    4811     1  0 12:04 ?        00:00:00 ora_dia0_DB1
    oracle    4813     1  0 12:04 ?        00:00:00 ora_mman_DB1
    oracle    4815     1  0 12:04 ?        00:00:00 ora_dbw0_DB1
    oracle    4817     1  0 12:04 ?        00:00:00 ora_lgwr_DB1
    oracle    4819     1  0 12:04 ?        00:00:00 ora_ckpt_DB1
    oracle    4821     1  0 12:05 ?        00:00:00 ora_smon_DB1
    oracle    4823     1  0 12:05 ?        00:00:00 ora_reco_DB1
    oracle    4825     1  0 12:05 ?        00:00:00 ora_mmon_DB1
    oracle    4827     1  0 12:05 ?        00:00:00 ora_mmnl_DB1
    oracle    4829     1  0 12:05 ?        00:00:00 ora_d000_DB1
    oracle    4831     1  0 12:05 ?        00:00:00 ora_s000_DB1
    oracle    4855  4774  0 12:05 ?        00:00:00 oracleDB1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
    oracle    4858  4729  0 12:05 pts/1    00:00:00 bash
    oracle    4875  4858  0 12:05 pts/1    00:00:00 ps -fu oracleA ps output. The db is in mounted state.
    Dim

  • Exact location of control file when db_create_online_log_dest_1 is set

    In case in the init.ora file the below three parameters are set
    db_create_file_dest =somepath1
    db_create_online_log_dest_1 =somepath2
    db_create_online_log_dest_2 = somepath3
    then in which location will the control files be created? Its an interview question.
    Kindly provide me info

    Ebenezer_863977 wrote:
    In case in the init.ora file the below three parameters are set
    db_create_file_dest =somepath1
    db_create_online_log_dest_1 =somepath2
    db_create_online_log_dest_2 = somepath3
    then in which location will the control files be created? Its an interview question.
    Kindly provide me info"Its an interview question."
    It's also a doc question
    http://download.oracle.com/docs/cd/E11882_01/server.112/e25494/omf002.htm#ADMIN11490
    http://download.oracle.com/docs/cd/E11882_01/server.112/e25513/initparams052.htm#REFRN10034

  • Remove the current control file when the database is running on linux or un

    Question From Oracler:
    下面这个例子中,假如controlfile被删除掉了,instance还没有关闭,可以通过lsof找出controlfile的file descriptors,再通过dd把文件恢复过来...
    我觉得这样dd出来的控制文件是没有办法直接启动这个数据库的,因为CKPT每3S一次,你dd恢复出来的控制文件SCN肯定和datafile不一样,比datafile小,... 要是recover会提示控制文件太久,不知道我理解正不正确啊?
    http://www.oracledatabase12g.com/archives/unix-linux%e4%b8%8b%e5%88%a0%e9%99%a4oracle%e6%8e%a7%e5%88%b6%e6%96%87%e4%bb%b6controlfile%e4%b8%ba%e4%bb%80%e4%b9%88%e5%ae%9e%e4%be%8binstance%e6%b2%a1%e6%9c%89%e7%ab%8b%e5%8d%b3%e5%a5%94%e6%ba%83.html
    dd恢复的控制文件 怎么会比打他file、
    怎么会比datafile的scn 小呢
    一旦关库,那么fd是不是就消失了,没有办法dd了, 那么造成scn不相同的原因是dd过程中scn的变化么?
    还请大致谈一下造成scn更新的必要条件。

    有网友提问,若控制文件是 create controlfile 重建得来的 又会如何? 这里我们可以看一下:
    我们来看一下:
    SQL> alter system switch logfile;
    System altered.
    SQL> select distinct checkpoint_change# from v$datafile_header;
    CHECKPOINT_CHANGE#
    15169797
    SQL> alter system checkpoint;
    System altered.
    SQL> select distinct checkpoint_change# from v$datafile_header;
    CHECKPOINT_CHANGE#
    15169802 =>E7783A
    15169802 =>E7783A 最近的一次FULL CHECKPOINT的SCN
    SQL> select name from v$tablespace;
    NAME
    SYSTEM
    UNDOTBS1
    SYSAUX
    USERS
    EXAMPLE
    TEMP
    SQL> alter tablespace SYSTEM begin backup;
    Tablespace altered.
    SQL> alter tablespace UNDOTBS1 begin backup;
    Tablespace altered.
    SQL> alter tablespace SYSAUX begin backup;
    Tablespace altered.
    SQL> alter tablespace USERS begin backup;
    Tablespace altered.
    SQL> alter tablespace EXAMPLE begin backup;
    Tablespace altered.
    SQL> alter tablespace SYSTEM end backup;
    Tablespace altered.
    SQL> alter tablespace UNDOTBS1 end backup;
    Tablespace altered.
    SQL> alter tablespace SYSAUX end backup;
    Tablespace altered.
    SQL> alter tablespace USERS end backup;
    Tablespace altered.
    SQL> alter tablespace EXAMPLE end backup;
    Tablespace altered.
    begin /end backup 会引发FILE CHECKPOINT ,造成datafile_header的 checkpoint_change# 更新
    SQL> select distinct checkpoint_change# from v$datafile_header;
    CHECKPOINT_CHANGE#
    15169814
    15169827
    15169842
    15169821
    15169835
    15169814 =>E77916 是最小的一个 datafile header checkpoint_change#
    SQL> oradebug setmypid;
    Statement processed.
    SQL> oradebug dump controlf 3;
    Statement processed.
    SQL> oradebug tracefile_name;
    但是此时去dump controlf 可以发现 控制文件中的database checkpint 仍是 E7783A 15169802 即上一次FULL CHECKPOINT的 SCN
    DATABASE ENTRY
    (size = 316, compat size = 316, section max = 1, section in-use = 1,
    last-recid= 0, old-recno = 0, last-recno = 0)
    (extent = 1, blkno = 1, numrecs = 1)
    03/09/2012 23:04:33
    DB Name "G10R21"
    Database flags = 0x00404001 0x00001000
    Controlfile Creation Timestamp 03/09/2012 23:04:33
    Incmplt recovery scn: 0x0000.00000000
    Resetlogs scn: 0x0000.00e7784f Resetlogs Timestamp 03/09/2012 23:11:46
    Prior resetlogs scn: 0x0000.00e77780 Prior resetlogs Timestamp 03/09/2012 22:57:44
    Redo Version: compatible=0xa200100
    #Data files = 16, #Online files = 16
    Database checkpoint: Thread=1 scn: 0x0000.00e7790a ==>15169802
    Threads: #Enabled=1, #Open=1, Head=1, Tail=1
    REDO THREAD RECORDS
    (size = 256, compat size = 256, section max = 8, section in-use = 1,
    last-recid= 0, old-recno = 0, last-recno = 0)
    (extent = 1, blkno = 9, numrecs = 8)
    THREAD #1 - status:0xf thread links forward:0 back:0
    #logs:3 first:1 last:3 current:2 last used seq#:0x2
    enabled at scn: 0x0000.00e7784f 03/09/2012 23:11:46
    disabled at scn: 0x0000.00000000 01/01/1988 00:00:00
    opened at 03/09/2012 23:11:46 by instance G10R21
    Checkpointed at scn: 0x0000.00e7790a 03/09/2012 23:12:12
    thread:1 rba:(0x2.3.10)
    SQL> alter database backup controlfile to trace;
    Database altered.
    SQL> oradebug setmypid;
    Statement processed.
    SQL> oradebug tracefile_name;
    SQL> shutdown abort;
    ORACLE instance shut down.
    [oracle@vrh8 ~]$ rm /s01/recreate.ctl
    我们以NORESETLOGS重建控制文件:
    SQL> startup nomount;
    ORACLE instance started.
    Total System Global Area 620756992 bytes
    Fixed Size 2022760 bytes
    Variable Size 234881688 bytes
    Database Buffers 377487360 bytes
    Redo Buffers 6365184 bytes
    SQL> show parameter control
    NAME TYPE VALUE
    control_file_record_keep_time integer 7
    control_files string /s01/recreate.ctl
    SQL> CREATE CONTROLFILE REUSE DATABASE "G10R21" NORESETLOGS ARCHIVELOG
    2 MAXLOGFILES 16
    3 MAXLOGMEMBERS 3
    4 MAXDATAFILES 100
    5 MAXINSTANCES 8
    6 MAXLOGHISTORY 2921
    7 LOGFILE
    8 GROUP 1 (
    9 '/s01/oradata/G10R21/onlinelog/o1_mf_1_7ch812dg_.log',
    10 '/s01/flash_recovery_area/G10R21/onlinelog/o1_mf_1_7ch813h5_.log'
    11 ) SIZE 50M,
    12 GROUP 2 (
    13 '/s01/oradata/G10R21/onlinelog/o1_mf_2_7ch8144q_.log',
    14 '/s01/flash_recovery_area/G10R21/onlinelog/o1_mf_2_7ch815cj_.log'
    15 ) SIZE 50M,
    16 GROUP 3 (
    17 '/s01/oradata/G10R21/onlinelog/o1_mf_3_7ch816g2_.log',
    18 '/s01/flash_recovery_area/G10R21/onlinelog/o1_mf_3_7ch817gp_.log'
    19 ) SIZE 50M
    20 -- STANDBY LOGFILE
    DATAFILE
    21 22 '/s01/oradata/G10R21/datafile/o1_mf_system_7ch8004t_.dbf',
    23 '/s01/oradata/G10R21/datafile/o1_mf_undotbs1_7ch80081_.dbf',
    24 '/s01/oradata/G10R21/datafile/o1_mf_sysaux_7ch8004x_.dbf',
    25 '/s01/oradata/G10R21/datafile/o1_mf_users_7ch80085_.dbf',
    26 '/s01/oradata/G10R21/datafile/o1_mf_example_7ch81ch3_.dbf',
    27 '/s01/oradata/G10R21/datafile/o1_mf_users_7gvd5pwh_.dbf',
    28 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6fdt_.dbf',
    29 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6nxy_.dbf',
    30 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6qc2_.dbf',
    31 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6stt_.dbf',
    32 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6w5w_.dbf',
    33 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6yo0_.dbf',
    34 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t717x_.dbf',
    35 '/s01/oradata/G10R21/datafile/o1_mf_undotbs1_7h6ttkkx_.dbf',
    36 '/s01/oradata/G10R21/datafile/o1_mf_undotbs1_7h6ttpn1_.dbf',
    37 '/s01/oradata/G10R21/datafile/o1_mf_undotbs1_7h6ttsbd_.dbf'
    38 CHARACTER SET AL32UTF8;
    Control file created.
    SQL> oradebug setmypid;
    Statement processed.
    SQL> oradebug dump controlf 3;
    Statement processed.
    DATABASE ENTRY
    (size = 316, compat size = 316, section max = 1, section in-use = 1,
    last-recid= 0, old-recno = 0, last-recno = 0)
    (extent = 1, blkno = 1, numrecs = 1)
    03/09/2012 23:16:57
    DB Name "G10R21"
    Database flags = 0x00400103 0x00001000
    Controlfile Creation Timestamp 03/09/2012 23:16:58
    Incmplt recovery scn: 0x0000.00000000
    Resetlogs scn: 0x0000.00e7784f Resetlogs Timestamp 03/09/2012 23:11:46
    Prior resetlogs scn: 0x0000.00e77780 Prior resetlogs Timestamp 03/09/2012 22:57:44
    Redo Version: compatible=0xa200100
    #Data files = 16, #Online files = 16
    Database checkpoint: Thread=1 scn: 0x0000.00e77902 15169794
    Threads: #Enabled=1, #Open=1, Head=1, Tail=1
    Database checkpoint: 变成了 00e77902 =》 15169794,比上次FULL CHECKPOINT的15169802 还要小
    这个
    00e77902 =》 15169794从哪里来?
    REDO THREAD RECORDS
    (size = 256, compat size = 256, section max = 8, section in-use = 1,
    last-recid= 0, old-recno = 0, last-recno = 0)
    (extent = 1, blkno = 9, numrecs = 8)
    THREAD #1 - status:0x7 thread links forward:0 back:0
    #logs:3 first:1 last:3 current:2 last used seq#:0x2
    enabled at scn: 0x0000.00e7784f 03/09/2012 23:11:46
    disabled at scn: 0x0000.00000000 01/01/1988 00:00:00
    opened at 01/01/1988 00:00:00 by instance
    Checkpointed at scn: 0x0000.00e77902 03/09/2012 23:11:54
    thread:1 rba:(0x2.2.0)
    LOG FILE RECORDS
    (size = 72, compat size = 72, section max = 16, section in-use = 3,
    last-recid= 0, old-recno = 0, last-recno = 0)
    (extent = 1, blkno = 10, numrecs = 16)
    LOG FILE #1:
    (name #3) /s01/oradata/G10R21/onlinelog/o1_mf_1_7ch812dg_.log
    (name #4) /s01/flash_recovery_area/G10R21/onlinelog/o1_mf_1_7ch813h5_.log
    Thread 1 redo log links: forward: 2 backward: 0
    siz: 0x19000 seq: 0x00000001 hws: 0x4 bsz: 512 nab: 0xb6 flg: 0x0 dup: 2
    Archive links: fwrd: 2 back: 0 Prev scn: 0x0000.00000000
    Low scn: 0x0000.00e7784f 03/09/2012 23:11:46
    Next scn: 0x0000.00e77902 03/09/2012 23:11:54
    LOG FILE #2:
    (name #1) /s01/oradata/G10R21/onlinelog/o1_mf_2_7ch8144q_.log
    (name #2) /s01/flash_recovery_area/G10R21/onlinelog/o1_mf_2_7ch815cj_.log
    Thread 1 redo log links: forward: 3 backward: 1
    siz: 0x19000 seq: 0x00000002 hws: 0x1 bsz: 512 nab: 0xffffffff flg: 0xa dup: 2
    Archive links: fwrd: 0 back: 1 Prev scn: 0x0000.00e7784f
    Low scn: 0x0000.00e77902 03/09/2012 23:11:54
    Next scn: 0xffff.ffffffff 01/01/1988 00:00:00
    LOG FILE #3:
    (name #5) /s01/oradata/G10R21/onlinelog/o1_mf_3_7ch816g2_.log
    (name #6) /s01/flash_recovery_area/G10R21/onlinelog/o1_mf_3_7ch817gp_.log
    Thread 1 redo log links: forward: 0 backward: 2
    siz: 0x19000 seq: 0x00000000 hws: 0x2 bsz: 512 nab: 0x2 flg: 0x1 dup: 2
    Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00000000
    Low scn: 0x0000.00000000 01/01/1988 00:00:00
    Next scn: 0x0000.00000000 01/01/1988 00:00:00
    原来这个
    00e77902 =》 15169794 来源于 current online redo logfile中最小的LOW SCN
    DATA FILE RECORDS
    (size = 428, compat size = 428, section max = 100, section in-use = 19,
    last-recid= 0, old-recno = 0, last-recno = 0)
    (extent = 1, blkno = 11, numrecs = 100)
    DATA FILE #1:
    (name #22) /s01/oradata/G10R21/datafile/o1_mf_system_7ch8004t_.dbf
    creation size=0 block size=8192 status=0x12 head=22 tail=22 dup=1
    tablespace 0, index=1 krfil=1 prev_file=0
    unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
    Checkpoint cnt:2314 scn: 0x0000.00e77916 03/09/2012 23:12:46
    Stop scn: 0xffff.ffffffff 03/09/2012 23:16:58
    Creation Checkpointed at scn: 0x0000.00000008 10/22/2005 21:44:31
    thread:0 rba:(0x0.0.0)
    DATAFILE 1 的checkpoint scn最小为 00e77916 =》15169814
    SQL> recover database using backup controlfile;
    ORA-00279: change 15169814 generated at 03/09/2012 23:12:46 needed for thread 1
    ORA-00289: suggestion :
    /s01/flash_recovery_area/G10R21/archivelog/2012_03_09/o1_mf_1_2_%u_.arc
    ORA-00280: change 15169814 for thread 1 is in sequence #2
    Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
    ORA-00279: change 15169814 generated at 03/09/2012 23:12:46 needed for thread 1
    可以看到 recover database using backup controlfile 的起点是 15169814 即 最小的一个 datafile header 的CHECKPOINT CHANGE#,
    也就是说 丢失控制文件 并(create controlfile)重建后的recover 从 最小的datafile header CHECKPOINT_CHANGE#开始 ,直到NEXT SCN 无穷大的 current logfile的 end 为止!
    我们在看一下 RESETLOGS的情况:
    SQL>
    SQL> CREATE CONTROLFILE REUSE DATABASE "G10R21" RESETLOGS ARCHIVELOG
    MAXLOGFILES 16
    2 3 MAXLOGMEMBERS 3
    4 MAXDATAFILES 100
    5 MAXINSTANCES 8
    6 MAXLOGHISTORY 2921
    7 LOGFILE
    8 GROUP 1 (
    9 '/s01/oradata/G10R21/onlinelog/o1_mf_1_7ch812dg_.log',
    10 '/s01/flash_recovery_area/G10R21/onlinelog/o1_mf_1_7ch813h5_.log'
    11 ) SIZE 50M,
    12 GROUP 2 (
    13 '/s01/oradata/G10R21/onlinelog/o1_mf_2_7ch8144q_.log',
    14 '/s01/flash_recovery_area/G10R21/onlinelog/o1_mf_2_7ch815cj_.log'
    15 ) SIZE 50M,
    16 GROUP 3 (
    17 '/s01/oradata/G10R21/onlinelog/o1_mf_3_7ch816g2_.log',
    18 '/s01/flash_recovery_area/G10R21/onlinelog/o1_mf_3_7ch817gp_.log'
    19 ) SIZE 50M
    20 -- STANDBY LOGFILE
    21 DATAFILE
    22 '/s01/oradata/G10R21/datafile/o1_mf_system_7ch8004t_.dbf',
    23 '/s01/oradata/G10R21/datafile/o1_mf_undotbs1_7ch80081_.dbf',
    '/s01/oradata/G10R21/datafile/o1_mf_sysaux_7ch8004x_.dbf',
    24 25 '/s01/oradata/G10R21/datafile/o1_mf_users_7ch80085_.dbf',
    26 '/s01/oradata/G10R21/datafile/o1_mf_example_7ch81ch3_.dbf',
    27 '/s01/oradata/G10R21/datafile/o1_mf_users_7gvd5pwh_.dbf',
    28 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6fdt_.dbf',
    29 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6nxy_.dbf',
    30 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6qc2_.dbf',
    31 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6stt_.dbf',
    32 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6w5w_.dbf',
    33 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t6yo0_.dbf',
    34 '/s01/oradata/G10R21/datafile/o1_mf_users_7h6t717x_.dbf',
    35 '/s01/oradata/G10R21/datafile/o1_mf_undotbs1_7h6ttkkx_.dbf',
    36 '/s01/oradata/G10R21/datafile/o1_mf_undotbs1_7h6ttpn1_.dbf',
    37 '/s01/oradata/G10R21/datafile/o1_mf_undotbs1_7h6ttsbd_.dbf'
    CHARACTER SET AL32UTF8; 38
    Control file created.
    SQL> oradebug setmypid;
    Statement processed.
    SQL> oradebug dump controlf 3;
    Statement processed.
    SQL> oradebug tracefile_name;
    DATABASE ENTRY
    (size = 316, compat size = 316, section max = 1, section in-use = 1,
    last-recid= 0, old-recno = 0, last-recno = 0)
    (extent = 1, blkno = 1, numrecs = 1)
    03/09/2012 23:20:03
    DB Name "G10R21"
    Database flags = 0x00400147 0x00001000
    Controlfile Creation Timestamp 03/09/2012 23:20:03
    Incmplt recovery scn: 0x0000.00e77932
    Resetlogs scn: 0x0000.00e7784f Resetlogs Timestamp 03/09/2012 23:11:46
    Prior resetlogs scn: 0x0000.00e77780 Prior resetlogs Timestamp 03/09/2012 22:57:44
    Redo Version: compatible=0xa200100
    #Data files = 16, #Online files = 16
    Database checkpoint: Thread=0 scn: 0x0000.00000000
    Threads: #Enabled=1, #Open=0, Head=0, Tail=0
    REDO THREAD RECORDS
    (size = 256, compat size = 256, section max = 8, section in-use = 1,
    last-recid= 0, old-recno = 0, last-recno = 0)
    (extent = 1, blkno = 9, numrecs = 8)
    THREAD #1 - status:0x6 thread links forward:0 back:0
    #logs:3 first:1 last:3 current:3 last used seq#:0x0
    enabled at scn: 0x0000.00000000 01/01/1988 00:00:00
    disabled at scn: 0x0000.00000000 01/01/1988 00:00:00
    opened at 01/01/1988 00:00:00 by instance
    Checkpointed at scn: 0x0000.00000000
    thread:0 rba:(0x0.0.0)
    LOG FILE RECORDS
    (size = 72, compat size = 72, section max = 16, section in-use = 3,
    last-recid= 0, old-recno = 0, last-recno = 0)
    (extent = 1, blkno = 10, numrecs = 16)
    LOG FILE #1:
    (name #5) /s01/oradata/G10R21/onlinelog/o1_mf_1_7ch812dg_.log
    (name #6) /s01/flash_recovery_area/G10R21/onlinelog/o1_mf_1_7ch813h5_.log
    Thread 1 redo log links: forward: 2 backward: 0
    siz: 0x19000 seq: 0x00000000 hws: 0x0 bsz: 512 nab: 0x0 flg: 0x1 dup: 2
    Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00000000
    Low scn: 0x0000.00000000 01/01/1988 00:00:00
    Next scn: 0x0000.00000000 01/01/1988 00:00:00
    LOG FILE #2:
    (name #3) /s01/oradata/G10R21/onlinelog/o1_mf_2_7ch8144q_.log
    (name #4) /s01/flash_recovery_area/G10R21/onlinelog/o1_mf_2_7ch815cj_.log
    Thread 1 redo log links: forward: 3 backward: 1
    siz: 0x19000 seq: 0x00000000 hws: 0x0 bsz: 512 nab: 0x0 flg: 0x1 dup: 2
    Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00000000
    Low scn: 0x0000.00000000 01/01/1988 00:00:00
    Next scn: 0x0000.00000000 01/01/1988 00:00:00
    LOG FILE #3:
    (name #1) /s01/oradata/G10R21/onlinelog/o1_mf_3_7ch816g2_.log
    (name #2) /s01/flash_recovery_area/G10R21/onlinelog/o1_mf_3_7ch817gp_.log
    Thread 1 redo log links: forward: 0 backward: 2
    siz: 0x19000 seq: 0x00000000 hws: 0x0 bsz: 512 nab: 0x2 flg: 0xb dup: 2
    Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00000000
    Low scn: 0x0000.00000000 01/01/1988 00:00:00
    Next scn: 0x0000.00000000 01/01/1988 00:00:00
    虽然database checkpoint scn 等都是0 ,但是不影响 从 最小的datafile header checkpoint change 开始recover的 结论。
    SQL> recover database using backup controlfile;
    ORA-00279: change 15169814 generated at 03/09/2012 23:12:46 needed for thread 1
    ORA-00289: suggestion :
    /s01/flash_recovery_area/G10R21/archivelog/2012_03_09/o1_mf_1_2_%u_.arc
    ORA-00280: change 15169814 for thread 1 is in sequence #2
    Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

  • Help needed for creating a SQLLoad control file

    I have 2 fields in my flat file
    If field1 = field2 load only field1 into tn and aux = NULL
    else if field1 != field2 load field1 into tn and field2 = aux
    Here is what I have so far - I need help with the "Where"
    -- ActiveNumbers.dat
    -- Steve J
    load data
    INFILE 'active.date'
    INTO TABLE tmp_ac_active
    APPEND
    FIELDS TERMINATED BY '|'
    (tn CHAR(10), aux CHAR(10))
    Thanks in advance
    Steve

    Thanks Joel
    Using the document you provided here is what I came up with. I notice this is 9i documents - I'm on 8. Does the SQLLoader work the same in both versions?
    This is the first time I've used this tool - No one here has even heard of it. (Well except for the DBA)
    load data
    INFILE 'active.date'
    -- Loads tn and aux if they do not match
    INTO TABLE tmp_ac_active
    WHEN tn != aux
    (tn CHARTERMINATED BY WHITESPACE,
    aux CHAR TERMINATED BY WHITESPACE)
    -- Loads only TN if both are the same
    INTO TABLE tmp_ac_active
    WHEN tn = aux
    (tn POSITION (1:10) CHAR)

  • Snapshot control file

    Hi,
    I am interested in time of snapshot control file creation.
    I have read that snapshot control file is created before the backup take the place. I have tried to take the simple rman>backup database command, but I have seen that snapshot control file is created after all backup process (I have seen the time of creating the snapshot control file).
    Can anybody tell me about this? When the snapshot control file is created (before backup, maybe in the memory, because I can't see it on the file system).
    Regards,
    Dragan

    Hi,
    I have read this sentence from Oracle Database 10g RMAN Backup & Recovery:
    RMAN needs to get a consistent view of the control file when it sets out to make backup of every datafile. It only needs to know the most recent checkpoint information and file schematic information at the time backup begins. After the backup starts, RMAN needs this information to stay consistent for duration of the backup operation; in other words, it needs a read consistent view of the control file. With the constant updates from the database, this is nearly impossible - unless RMAN were to lock the control file for the duration of the backup. But that would mean the database could not advance checkpoint or switch logs or produce new archive logs. Impossible.
    To get around this, RMAN uses the snapshot control file, an exact copy of your control file that is only used by RMAN during backup and resync operations. At the beginning of these operations, RMAN refreshes the snapshot control file from the actual control file, thus putting a momentary lock on the control file. Then, RMAN switches to the snapshot and uses it for the duration of the backup; in this way, it has read consistency without holding up database activity.
    I must ask you if I am using control file only (not recovery catalog) what is happening when I am executing simple RMAN command> backup database;
    You have said that I don't create snapshot of control file at that moment, only at the end of the backup process (I have also try it in my environment and snapshot is created at the end of the backup process).
    How RMAN knows what to backup (which files), he takes this information from original control file (not from snapshot) I suppose.
    What is happening when he finished backup of some backup set, he writes that information again in original control file I suppose.
    And at the end of all process why he takes snapshot of control file (to backup control file from it, not from original control file, because control file is always changing, need to lock it). In that snapshot control file (and in the its backup) we will have the pointers on files that are made after the backup process started (is this true).
    Thanks,
    Regards
    Dragan

  • Problem in recreating control file

    Hi,
    When i recreate controlfile ... It creates a set of datafile...
    FILE# NAME STATUS
    84 /u01/app/oracle/product/10.2.0/dbs/MISSING00084 RECOVER
    85 /u01/app/oracle/product/10.2.0/dbs/MISSING00085 RECOVER
    86 /u01/app/oracle/product/10.2.0/dbs/MISSING00086 RECOVER
    Only these datafiles give problem... but these or no way related to my db. And i dint create.

    Hi,
    I have took the trace of the control file , from that i recreated the control file.
    after creating the control file when i query,
    select name from v$datafile;
    i dint find the files.. but when i gave
    alter database open resetlogs;
    alter this only the file appears...
    oracle version is 10.2.0

  • Importing already-made SQL*Loader control files in OWB 10g

    Hi all,
    Suppose that I have a certain amount of already hand-made SQL*Loader control files, say 50 or so.
    Each of these control files have a variable quantity of fields.
    I feel really lazy, so I would like to know if it is possible to import directly these control files instead of re-typing them in the design center. That would save me a lot of time.
    Thanks !
    Burgy

    Hi Burgy
    One option is to use the sqlloader option to generate an external table from the SQLLoader control file (search for generate_only in the sqlloader documentation). If you define the external table in the database you can reverse engineer this into OWB.
    Cheers
    David

  • Whwn to create a standby control file?

    Hi All ,
    I want to setup a standby database for my Production DB.
    I have a doubt, can we create a Standby by control file when the Primary database is up and running(read-write) mode. or else it is must to be in mount state only ?
    Please advise.
    Thanks.

    Hello;
    I do it like this: (And then copy the STANDBY.ctl to the Standby system and rename)
    SQL>startup mount;
    SQL>alter database create standby controlfile as 'STANDBY.ctl';
    This command will fail is STANDBY.ctl exists.
    See step 8 of my cliff notes here:
    http://www.visi.com/~mseberg/data_guard_on_oracle_10_step_by_step.html
    Or Step 7 if Oracle 11 here:
    http://www.visi.com/~mseberg/data_guard_on_oracle_11_step_by_step.html
    Best Regards
    mseberg

  • Sqlloder - increase the commit point in control file

    How can I increase the commit point in sqlloader control file?
    The default is I think 64 and I want it to commit afer every 1000 records inserted.
    Thanks for the help
    ds

    user10 wrote:
    How can I increase the commit point in sqlloader control file?
    The default is I think 64 and I want it to commit afer every 1000 records inserted.
    Thanks for the help
    dsno such parameter
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_params.htm#g1014550

  • Measuring thr control file size

    Dear Friends ,
    I know that , RMAN records are kept on the control file when I dont use recovery Catalog .
    Barring this , RMAN also keep database related informations . In this case my question is ,
    Is the control file size ups and down ? How can I measure or manage the size of the control file .
    I m using Oracle 10g , here in OEM I cannot find anything to see or manage the control file size .
    Plz help me ... ..

    Hi,
    Change Maxdatafiles, Maxlogfiles after Creating Database:
    1. Dump a trace of the controlfile.
    Use SQL*Plus (or Server Manager) and enter:
    SQL> alter database backup controlfile to trace ;
    2. Modify the created trace file (located in the user_dump_dest directory):
    a) remove from the first line to the line before "STARTUP NOMOUNT"
    b) remove line "ALTER DATABASE OPEN" to the end of the file
    c) change value of maxdatafiles, maxlogfiles and other parameters as desired
    d) rename the file to something .sql (such as cntl.sql)
    3. Shutdown the database.
    4. Backup the database.
    5. Run SQL*Plus (or Server Manager) and do the following:
    SQL> connect / as sysdba
    SQL> @cntl.sql (The SQL script that you created in step 2)
    SQL> alter database open noresetlogs ;
    Note:
    Beginning in Oracle8, when you issue CREATE DATABASE or CREATE CONTROLFILE
    statements, the MAXDATAFILES parameter specifies an initial size of the datafile
    portion of the control file. Later, if you add a file whose number exceeds
    MAXDATAFILES but is less than or equal to the value specified by the DB_FILES
    initialization parameter, the control file automatically expands to allow the
    datafile portion to accommodate more files. You will not need to recreate the
    controlfile in this case.
    Ps :- If your question is Answered mark the Appropriate Response / Reply
    - Pavan Kumar N

Maybe you are looking for

  • Inspiron 9300 cd drive performance

    well, i put arch linux on my laptop last week. its one with ide drives, not sata. dell never officially doc'd a difference between the two and put out very few with sata in them. i worked for them so i had the inside info on that, lol. anyway, basica

  • Apple tv no longer starts with airplay

    Previous I never needed to use the Apple tv remote to start my ATV 3. When I used the airplay function on my iPad it automatically started. One of the most recent updates must have broken/removed that function. Is it just me or did Apple remove that

  • JMS Sender CSV

    hi, Please solve this.. If the structure is like this, is it possible to content conversion in source sender JMS Adapter. the source the structure is as below: <?xml version="1.0" encoding="UTF-8"?> <ns0:MT_Mapping> xmlns:ns0="http://namespac.test">

  • Idvd burn/encoding problem

    When I try to burn an idvd project I keep on getting a msg reading 'Your project exceeds the maximum content duration. To burn your DVD, change the encoder setting in the Project Info window.' However when I check project info the project is way unde

  • My iPhone 5' keeps shutting down and now I've noticed the screen seems to be lifting up

    help my iPhone 5 phone keeps turning off regardless of battery percentage and now I've noticed the screen lifting up.. What's happening?