rman passing parameters
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: rman passing parameters

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Posts
    195

    rman passing parameters

    I have the following script Note backup tag='FullBkup_&1'

    cat fullbackup.rman
    ===============

    rman < connect target sys/sys@GOLD_PRI
    connect catalog rman/rman@GOLD_PRI

    crosscheck Backup;
    crosscheck Archivelog All;
    run {
    SQL 'alter system switch logfile';

    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oracle/backup/pri/control_file_%F';

    CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
    ALLOCATE CHANNEL t1 DEVICE TYPE DISK FORMAT '/oracle/backup/pri/fullback_%U';
    ALLOCATE CHANNEL t2 DEVICE TYPE DISK FORMAT '/oracle/backup/pri/fullback_%U';
    ALLOCATE CHANNEL t3 DEVICE TYPE DISK FORMAT '/oracle/backup/pri/fullback_%U';

    backup tag='FullBkup_&1' full database
    plus archivelog delete all input;

    release channel t1;
    release channel t2;
    release channel t3;

    }

    delete noprompt obsolete;

    EOF

    When I call the script like this (see below) the &1 does not expand to the date, which I passed in. Can somebody tell me what the problem is?

    fullbackup.rman `date +"%Y/%m/%d-%H:%M:%S"`


    RMAN> list backup;


    List of Backup Sets
    ===================

    BS Key Size Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    3953 666.00K DISK 00:00:01 03-AUG-10
    BP Key: 3958 Status: AVAILABLE Compressed: YES Tag: FULLBKUP_&1
    Piece Name: /oracle/backup/pri/fullback_3nlke0kn_1_1

    BTW, I am running Oralce 10g version 10.2.0.1.0

  2. #2
    Join Date
    Mar 2006
    Location
    Charlotte, NC
    Posts
    865
    echo &1 before rman block and see what value it is taking.

    Thanks,
    Vijay Tummala

    Try hard to get what you like OR you will be forced to like what you get.

  3. #3
    Join Date
    Jul 2006
    Posts
    195
    When I echo $1 as suspected I get the value 2010/08/03-16:39:54
    when I echo &1 I get the value &1.

    Not surprised at tha.

    The problem is that the value is not being passed into the rman block. How
    do I do that?

    I know I can't do something like this this:

    rman $1 < bla
    bla
    bla
    EOF

    So how can I pass parameters into the block?

  4. #4
    Join Date
    Mar 2006
    Location
    Charlotte, NC
    Posts
    865
    capture the $1 into a parameter before RMAN block and use that parameter inside RMAN block.

    backup tag='$parameter' full database
    Thanks,
    Vijay Tummala

    Try hard to get what you like OR you will be forced to like what you get.

  5. #5
    Join Date
    Jul 2006
    Posts
    195
    No need to capture it into a parameter rman will recognize $1 and expand it.
    I was under the impression that variables had to be in the format &

    my solution

    backup.rman `date +"%Y/%m/%d-%H:%M:%S"`


    backup.rman
    ===========
    rman < connect target sys/sys@GOLD_PRI
    connect catalog rman/rman@GOLD_PRI

    crosscheck Backup;
    crosscheck Archivelog All;
    run {
    SQL 'alter system switch logfile';

    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oracle/backup/pri/control_file_%F';

    CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
    ALLOCATE CHANNEL t1 DEVICE TYPE DISK FORMAT '/oracle/backup/pri/fullback_%U';
    ALLOCATE CHANNEL t2 DEVICE TYPE DISK FORMAT '/oracle/backup/pri/fullback_%U';
    ALLOCATE CHANNEL t3 DEVICE TYPE DISK FORMAT '/oracle/backup/pri/fullback_%U';

    backup tag='FullBkup_$1' full database
    plus archivelog delete all input;

    release channel t1;
    release channel t2;
    release channel t3;

    }

    delete noprompt obsolete;

    EOF

  6. #6
    Join Date
    Mar 2006
    Location
    Charlotte, NC
    Posts
    865
    glad to see that your issue is resolved.

    Thanks,
    Vijay Tummala

    Try hard to get what you like OR you will be forced to like what you get.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width