Script for automation.

Rhel 5.
11.2.0.3
Any body have idea how to write a scripts to fullfill below requirments.
script 1) Change Partition name and subpartition name ( Range Hash). First List and then change.
script 2) Estimate Size and then purge data of selected partition by exchanging into a separate table.
any help will be highly appreciated!!
My workaround is
*1) script 1*
i) partition and sub partition listening.
select table_name, PARTITION_NAME,TABLESPACE_NAME from user_tab_partitions where table_name='XXXX';
select partition_name,TABLESPACE_NAME from user_segments where segment_name='XXXX';
partition and subparition renaming
ii) partition and sub parition renaming.
alter table <tablename> rename partition <old parition name> to <new parition name>;
ALTER TABLE <tablename> RENAME SUBPARTITION <old-partition-name> TO <new-partition-name>;
*2) scrpit 2*
I) Estimate size of sub parition
select substr(partition_name,1,7) p_name,sum(bytes)/1024/1024 "MB" from user_segments where segment_name='INFO' group by substr(partition_name,1,7);
ii) Exchange parition.
a) create a table with sub parition type i.e hash parition table
b) create new table rang hash.
c) first exchange partition with sub partition type table than exchange sub partition type table with new rang hash partition.
alter table <old range hash table> exchange partition <partition name> with table <sub type hash table>;
alter table <sub type hash table> exchange partition <partition name> with table <new range hash table>;
Now my question is how can i read partition and sub parition names in script and than rename and exchange it dynamically??.
Edited by: Kh$n on Apr 25, 2013 5:20 AM

1) day wise not month wise.what? dont understand sorry, plase elaborate it.
2) i dn.t want to truncate it directly before truncating i want to save that data to another table thats why am exchanging it.with an example:
SQL> CREATE TABLE my_table
  2  (id  NUMBER(5),
  3  name VARCHAR2(30),
  4  mydate    DATE)
  5  PARTITION BY RANGE(mydate)
  6  (
  7  PARTITION january2013 VALUES LESS THAN(TO_DATE('01/02/2013','DD/MM/YYYY')),
  8  PARTITION february2013 VALUES LESS THAN(TO_DATE('01/03/2013','DD/MM/YYYY')),
  9  PARTITION march2013 VALUES LESS THAN(TO_DATE('01/04/2013','DD/MM/YYYY')),
10  PARTITION april2013 VALUES LESS THAN(TO_DATE('01/05/2013','DD/MM/YYYY'))
11  );
Tabla creada.
SQL> insert into my_table values (1, 'Fran', '01/01/2013');
1 fila creada.
SQL> insert into my_table values (1, 'Mike', '11/02/2013');
1 fila creada.
SQL> insert into my_table values (1, 'Donald', '11/03/2013');
1 fila creada.
SQL> insert into my_table values (1, 'Anna', '11/03/2011');
1 fila creada.
SQL> commit;
Confirmaci¾n terminada.
SQL>
SQL> select * from my_table;
        ID NAME                           MYDATE
         1 Fran                           01/01/13
         1 Anna                           11/03/11
         1 Mike                           11/02/13
         1 Donald                         11/03/13
SQL> create table my_new_table(id number(5), name varchar2(30), my_date date);
Tabla creada.
SQL> select * from my_new_table;
ninguna fila seleccionada
SQL> ALTER TABLE my_table
  2  EXCHANGE PARTITION march2013
  3  WITH TABLE my_new_table;
Tabla modificada.
SQL> select * from my_new_table;
        ID NAME                           MY_DATE
         1 Donald                         11/03/13
SQL> select * from my_table;
        ID NAME                           MYDATE
         1 Fran                           01/01/13
         1 Anna                           11/03/11
         1 Mike                           11/02/13With this you directly exchange data from partition to a table, don't need to purge the partition.

Similar Messages

  • Script for Automator to reorder text in file/folder name.

    I have a folder full of pictures named by their first and last names. I need them to be renamed by listing them by last name first, first name last in order to get them alphabatized properly. Anybody out there have a nice Automator script for me to make this happen? I'm new.
    Looking for it to look like this:
    Brown, John

    Try this (should work for "John H Smith" --> "Smith John H" as well):
    The Run Shell Script Action is:
    for f in "$@"
    do
        basename=${f##*/}
        path=${f%/*}
        ext=${f##*.}
        name=${basename%.*}
        if [[ "$name" =~ \  ]]; then
            fname=${name% *}
            lname=${name##* }
            name="$lname $fname"
            mv "$f" "$path/$name.$ext"
        fi
    done
    If you want a comma, then change: name="$lname $fname" to name="$lname, $fname"
    As with all scripts, back-up the files before running

  • Need Help with scripting for Automator/AppleScript.

    Hi everybody,
    I am building a small app for my mac, What I need is a script that can rename a file that I drop on it.
    and example being:
    example.jpg
    (when I drop it on the app, I want the app to change the filename of the document to "Image.jpg"
    I have tried this with Automator, but it requires that I specify the file to be changed, what I need is something that will change the name of any file I drag onto it.
    I am using it for application specific files.
    Kind regards,
    Pete.
    iBook G4; 60GB Hard Drive, 512MB RAM, Airport Extreme    

    Open the Script Editor in the
    /Applications/AppleScript/ folder and enter the
    following:
    on open(the_file)
    tell application "Finder"
    set name of the_file to "Image"
    end tell
    end open
    Save this script as an application.
    (11347)
    this script compiled correctly; however when run it returned the following error "Can't set name of (the_file) to "Image.jpg"
    I am also given the option of editing the script or just quitting.
    thanks for your help

  • Script for automated partitioning in the next official release?

    Disclaimer: don't run it with root privileges unless /dev/sda is a blank disk. You have been warned.
    # dhcpcd
    # curl sprunge.us/WATU > autopart #Uppercase required.
    # nano autopart
    # sh autopart
    http://sprunge.us/WATU
    Tested in VirtualBox.
    I remember that the AIF used 100 MB for /boot and 7.4 GB for "/". Close enough, right?
    Users can also edit the script and make their own version. What do you think?
    Last edited by DSpider (2012-08-07 08:22:26)

    DSpider wrote:
    Here's what it looks like multiplied by 1024: http://i.imgur.com/fttkB.png
    And here's what it looks like by 1000: http://i.imgur.com/oaCxF.png
    I don't know about you, but I very much dislike 7.81 GB, 1.95 GB, etc. If you're going to test it in VirtualBox, please create a virtual drive of at least 15.1 GB (100+8+2+5), or, you know, use smaller numbers. Also, using "Dynamic Size" only takes up about 60 MB or so of actual space, so you may as well create a 20 GB+ virtual drive.
    I am doing the max calculation directly on my desktop computer and using 1000 is the only result that corresponds to the label on the disk, so to speak. I'm not sure though, have to look closer at this when I get the time.

  • Batch script for automating process

    Hi all, not sure if this is the right area asking about batch scripts, but this has to do with the back-end system in Hyperion.
    I was wondering if there is a way to run a batch script on the transaction log that will give a list of any new GL accounts that have been added in the prior month or within the last 30 days? Can it also show which users are added to the account?
    The purpose of this is to automate the process periodically and eliminate the Outline Maintenance Log or import to the Outline Maintenance Log. It would be helpful for adding more new cost centers.
    Lastly, can I also run a batch script to see how often our end-users are in Hyperion reports?
    thank you.

    +...give a list of any new GL accounts that have been added in the prior month...+
    Correct me if i'm wrong:
    You want to know new members added in the account dimension recently. Is that right?
    If so, you could do a select command like that:
    SELECT O.OBJECT_NAME -- Just the member name. For alias, you need another join
    FROM HSP_ACCOUNT A -- For performance, i put the smallest table here
    INNER JOIN HSP_OBJECT O ON A.ACCOUNT_ID = O.OBJECT_ID -- Join to get the member name
    WHERE O.CREATED >= (SYSDATE-(30)) -- last 30 days
    Note this specific select you can only get the account dimension. Entity has his own table too.
    For custom dimention it gets a little more complicated.

  • Router script for Automated router changes

    I am new to the scripting world and do need assistance in developing a script that will assist me to perform the following tasks when executed
    1] remove all existing tunnels
    2] remove dialer/BVI interface
    3] create new DMVPN tunnel
    - tunnel x--- MPLS connection to data center
    -tunnel y--- Guest traffic
    4] Configure interface gi0/2 for broadband connection
    - negotiate DHCP addresses
    5] remove RIP routing
    6] remove EIGRP routing
    7] remove route-map pbr-dsl
    8] remove route-map pbr-extsrv
    9] create route-map for internet traffic over verizon ( pbr-verizon)
    - set interface gi0/2
    10] create route-map for internet traffic over mpls (pbr-mpls)
    - set interface ser0/0
    11] apply pbr-verizon to VLANS 10,20,30,40
    12] modify NAT statement
    13] create inbound and outbound ACL for Gi0/2 interface
    - permit udp gre traffic from VIP
    - permit tcp any any established
    -permit tcp any any eq ftp-data
    -permit udp any any eq domain
    14] combine all other ACL to ensure no blocking will occur based on all internet traffic from verizon and not mpls

    Joseph,
    My question is on syntax when using username and password.  I'm stuck on a script that I found here on the support forums that is using the Expect command. 
    My goal is to run the script from a host monitoring server using a device list file to go out and telnet into each one of the routers to run a "Show Inventory" command. 
    All the routers are using local AAA with username and password to get to the Privledged Exec mode.  Here's a copy of my script.  I have bolded the parts that I'm curious if correct.  If you could check over it and let me know where my mistakes (If any) are located, I'd appreciate it.  Thanks, Brandon
    # Here, we specify all our commands in a list, that we will issue one
    # by one at a later time.
    set commands {
        "show inventory"
    # This variable is for a file called hosts.txt that has the hostname/IP
    # of all of the routers you are collecting information from.
    set device_list [read [open "hosts.txt"]]
    # Specify the username and password, as well as what we expect the routers'
    # prompt to be.
    set username "blah"
    set pass "mypassword1234"
    set prompt "#"
    # This command tells expect not to echo the output to the console.
    exp_log_user 0
    # We loop through each device in our list, one by one...
    foreach device $device_list {
        # Set each device's log file to be the name of the device...
        # (i.e. router1.location.com-log.txt)
        set file_name "$device-log.txt"
        # Assuming you are using PuTTY, and have plink.exe, we initiate the SSH
        # connection
        exp_spawn plink.exe -telnet $device
        # If we see a message asking about the device's host key, accept it.
        expect -re ".*ogin:" {
            exp_send "$username\r"
            exp_send "$pass\r"
        # We log our output from each router to its specified file.
        exp_log_file -a $file_name
        # Loop through each command that we specified earlier.
        foreach cmd $commands {
            expect -re $prompt {
                exp_send "$cmd\r"
                exp_sleep 1
        # Now we enter enable mode for the running-config
        expect -re $prompt {
            send "en\r"
        expect -re ".*assword:" {
            send "$enable_pass\r"
        expect -re $prompt {
            send "term len 0\r"
        expect -re $prompt {
            send "show running-config\r"
        expect -re $prompt {
            exp_send "quit\r"
        # Turn off logging.
        exp_log_file

  • Script for automator to names jpegs with incorrect metadata date

    I use Automator to name my images YYYYMMDDHHMMSSname.jpg. Some images have the incorrect time stamp because I forgot to change the camera time while traveling in a different time zone. How do I write a script to correct this?
    G5, dual 2 GHz   Mac OS X (10.4.8)  

    If your camera records EXIF data with each jpeg, then try using EXIF Renamer rather than Automator.
    20 iMac G5, 1.25Gb RAM, 20Gb iPod, iSight   Mac OS X (10.4.8)   Newton 2100, 2000 (upgraded).

  • HACMP Clustering Script for SAP ECC 6.0 (SR1) - Automatic Failover

    Hello,
    I have installed the SAP ECC 6.0 (SR1) under AIX 5.3 / DB2 V8 FP12 with HACMP Clustering environment. Manual Failover is working fine. Central System has been installed in share drive with Virtual IP and Virtual name inNode A. Dialog Instance is loaded locally in Node B. I want to get HACMP Clustering script(automatic failover script) for Automation. Please help me if you have. It is single package clustering. If Node A fails, Node B will take care ( Central System and Dialog instance will run in Node B)
    Thanks
    Gautam Poddar

    this post is duplicated at Upgrade to ERP 2005/ECC 6.0 from  R/3 4.72/Basis 640 on Z/OS 1.4 DB2 8.1

  • HACMP Clustering Script for SAP ECC 6.0 (SR1) - Automatic Failover-Oracle10

    Hello,
    I have installed the SAP ECC 6.0 (SR1) under AIX 5.3 / Oracle 10g with HACMP Clustering environment. Manual Failover is working fine. ASCS and Database instances are loaded in share drive with Virtual IP and Virtual name. Central Instance and Dialog Instance are loaded locally in Node A and Node B. I want to get HACMP Clustering script(automatic failover script) for Automation. Please help me if you have.
    Thanks
    Gautam Poddar

    Here are HA stop & start scripts that you should be able adapt for your particular circumstances. Based on earlier versions of SAP / Oracle but assume should be a reasonable guide
    Script to start SAP is start_sap_prd
    #!/bin/ksh
    Script:         /usr/local/bin/cluster/start_sap_prd
    Comments:       HACMP Application START script for PRD
    Show me obvious information in hacmp.out
    banner "Starting"
    banner "PRD SAP"
    Set the oracle and sap owner.
    ORASID="PRD"
    SAPADM="prdadm"
    ORAUSR="oraprd"
    VIRTUALHOST="vhost"
    DEVHOST="vhostdev"
    Get the volume groups for this resource group
    RG=$( /usr/es/sbin/cluster/utilities/cllsgrp | grep -i $ )
    VG_LIST=$( /usr/es/sbin/cluster/utilities/cllsres -g $ | \
            grep "VOLUME_GROUP=" | \
            awk -F\" '{ print $2 }' )
    Check the transport directory is mounted.
    if mount | grep -w "/usr/sap/trans"
      then
            print "Transport directory is already mounted."
      else
            cd /tmp
            print "Attempting a background mount of the transport directory."
            nohup mount -o intr,bg,soft :/usr/sap/trans1 /usr/sap/trans &
    fi
    #Start SAP and Oracle
    #Start listener
    su - $ -c /rprd/oracle/PRD/920_64/bin/lsnrctl start
    rc=$?
    if [ $? != 0 ]
      then
            echo "ERROR: Listener failed to start\n"
    fi
    #Start Database
    su - $ -c "/rprd/oracle/PRD/bin/start_database_PRD.sh"
    sleep 20
    Standard sapstart script
    su - $ -c startsap $
    Script:       /usr/local/bin/cluster/stop_sap_prd
    Dated:        01/11/06
    Application:  Oracle/SAP
    Comments:     HACMP Application STOP script for SAP / Oracle PRD
    Show me obvious information in hacmp.out
    Set the oracle and sap owner.
    rc=$?
    if [ $? != 0 ]
    then
            echo "ERROR: Failed to start SAP\n"
    fi
    exit 0
    Script to stop SAP is stop_sap_prd
    #!/bin/ksh
    set -x
    banner "stopping"
    banner "PRD SAP"
    ORASID="PRD"
    SAPADM="prdadm"
    ORAUSR="oraprd"
    VIRTUALHOST="vhost"
    #Stop SAP/Oracle
    su - $ -c stopsap $
    rc=$?
    if [ $? != 0 ]
    then
            echo "ERROR: Failed to stop SAP and Oracle\n"
            break
    fi
    Stop SAP collector and Oracle listener.
    su - $ -c /usr/sap/PRD/SYS/exe/run/saposcol -k
    rc=$?
    if [ $? != 0 ]
    then
            echo "ERROR: Failed to stop SAPOSCOL \n"
    fi
    su - $ -c /rprd/oracle/PRD/920_64/bin/lsnrctl stop
    rc=$?
    if [ $? != 0 ]
    then
            echo "ERROR: Listener failed to stop\n"
    fi
    if mount | grep -w "/usr/sap/trans"
      then
            print "Transport directory is mounted."
            /usr/es/sbin/cluster/events/utils/cl_nfskill -k -u /usr/sap/trans
            sleep 1
            /usr/es/sbin/cluster/events/utils/cl_nfskill -k -u /usr/sap/trans
            sleep 1
            umount -f /usr/sap/trans &
      else
            print "Transport directory is not mounted."
    fi
    exit 0

  • Anybody Used WHG FTP Backup Script for Cpanel?

    Has anybody had experience with this script for automated
    backup with thier
    Cpanel software?
    http://www.webhostgear.com/174.html
    TIA,
    Jon Parkhurst
    PriivaWeb
    http://priiva.net.

    Or this service, or any data backup service?
    http://www.tranxactglobal.com/backupservice.php
    Basically just looking for low-cost backup solutions. Would
    rather have a
    script (bought or free, whichever works better) than a
    service, b/c I want
    to have close control over it.
    Thanks,
    Jons

  • Load Scripts for stress testing any OAF related application

    This may not be the correct forum. However, i'm sure many of you might have used load scripts to stress test your OAF related application.
    Can any of please shed some light on how to make these load scripts for automated testing for finding the performance of OAF appls (like iPro or iExpense)? What tool do we use for these type of Self Serv appls? How can we parameterise some of the session related values inside load scripts?
    Any of your experiences will give me a good start....Thanks

    Answers to these questions are generally dependent on the application server to which you will be deploying, as each application server has its own means of tuning for performance.
    For tuning Sun's App Server 8, see the online Performance Tuning Manual, at http://docs.sun.com/app/docs/doc/819-2561
    // Gregory

  • Alert and Monitoring Scripts for Hyperion Applications

    Hi Gurus,
    Can you please provide me with any customized scripts for automating alert mails and monitoring activities pertaining to Hyperion Applications.
    If not, can you please suggest some alternatives where i can get hold of some scripts. Any kind of help is greatly appreciated.
    Also can someone please throw some light about the APPMULE and how to procure their services or we can get it for free trial.
    Regards,
    Uday

    Any kind of leads on this is really appreciated.
    Regards,
    Uday

  • About shell scripts for large-scale automation of  encoding tasks

    in the user menu of Compressor, it said that we can use the command line to write shell scripts for large-scale automation of encoding tasks.
    I would like to have more information about the shell script for compressor, is that any document link?
    Thanks

    You can use a script function to set-up a more secure environment that you call at the start of every admin script. This could be your main stamp album for stuff that can be moved there.
    A few more stamps to add to the collection (be sure to read up on them before use):
    1) reset the command hash
    hash -r
    2) prevent core dumps
    ulimit -H -c0
    3) set the IFS
    4) clear all aliases  (see unalias -a)
    Also you can remove the ALL from sudo and add explicit commands to the the sudoers file. There's a lot of fine tuning you can do in sudoers - inc. env variables as teekay said.
    But I'm no expert so best to check all of the above.

  • JavaScript for Automation Cannot Use Scripting Addition Commands

    Attempting to recreate the example script for Messages called "Speak Events" with the new JavaScript for Automation in Yosemite, I found that it is impossible to use any scripting addition commands. For example:
    Messages = Application.currentApplication()
    Messages.includeStandardAdditions = true
    function messageReceived(m, e) {
         Messages.say(m)
    I have removed all the other (annoyingly) necessary function overrides for brevity. Similar AppleScript code functions just fine, but this will result in a privilege error because the system wrongly categorizes it as being sent cross-application. Is there any estimate on a bug fix for this?
    I've tried everything I can think of to work around this issue, even adding /usr/bin/osascript to the Security & Privacy Accessibility listing ("Allow the apps below to control your computer") which is not possible without editing the SQLite DB.
    The documentation included in Script Editor is also woefully inadequate, lacking a readable listing of what exactly is being passed into the handler function. How can I translate an AppleScript line like "received theMessage from theBuddy for theChat with eventDescription" into a reasonable function signature for JavaScript?

    It is a big SDK and to learn its features requires a lot of reading. But to start with I guess I should start with "Introduction to SDK".
    Since you want to control Acrobat from another application you should consider this under "Interapplication communication". You will be using OLE/COM.

  • How to create services start and stop automation script for diff servers

    Hi All,
    i want to create a bat file for automation purpose to start and stop services
    i have some services in 1st server aand some in 2nd server and some in 3rd servers.
    has you all know i have to follow sequences to start and stop services can any help me in creating .bat by linking 3 servers fo starting and stoping services.
    Thanks in advance
    Regards
    SM

    Hi,
    this is the list of start oder for services in 11.1.2.1 from the Installation and Configuration Guide
    1. Databases for repositories.
    2. Any corporate user directories that you plan to configure for use with Shared Services.
    3. Foundation Services Managed Server application server, which includes Shared Services,
    and EPM Workspace.
    4. Reporting and Analysis Framework — Agent Service (if required for your environment)
    5. Reporting and Analysis Framework Application Server (if required for your environment)
    6. Web server
    The remaining services and processes can be started in any order:
    1. Performance Management Architect Services
    2. Performance Management Architect application server
    3. Performance Management Architect Data Synchronizer application server
    4. Essbase Server
    5. Administration Services application server
    284 Starting and Stopping EPM System Products
    6. Integration Services Server
    7. Essbase Studio Server
    8. Provider Services application server
    9. Financial Reporting Services
    10. Financial Reporting application server
    11. Web Analysis application server
    12. Calculation Manager application server
    13. Planning application server and the Hyperion RMI Registry
    14. Financial Management service
    15. Financial Management Web application server
    16. Strategic Finance service
    17. Performance Scorecard application server
    18. Performance Scorecard Alerter application server
    19. Profitability and Cost Management application server
    to start services on different servers you can use the sc command in your batch file
    for eg
    sc \\10.121.201.21 start HypS9FrameworkAgent

Maybe you are looking for

  • Shadows disappearing when PDF/X-1 made?

    Ive created a file in InDesign CS3 with some simple swooshes at the bottom... All art was created in InDesign (not placed from Illustrator). I need to create a PDFX-1 file from this for a vendor.... However, when I do this, I lose the shadows on swoo

  • Final render does not replicate what is on canvas

    I am creating a highlight reel for a a football player. In order to make the video easy to understand i created a circular highlight to follow the player in the clip. I used the "shape" option and animated with setting keyframes in the motion tab. Wh

  • Adobe Reader 11.2.0

    Adobe Reader just updated to a newer version last night on my Asus TF300T tablet and now my docking keyboard won't work to enter letters or numbers in interactive PDF forms. What can I do to resolve this?

  • How to get asm diskgroups read/writes per hour or day

    Hi , we have 2 production databases sitting on same server (2 node RAC) and using the same ASM disk groups. we have been having issues since past 2 days where we see lot of I/O from one of the dabase . I was asked to provide the disk I/O stats from p

  • I need a mechanism to expose action script class reference to java script

    I need a mechanism to expose action script class reference to java script