zoukankan      html  css  js  c++  java
  • perl管理oracle实例

    -- perl oracle管理
    #!/usr/bin/perl
    use strict;
    use warnings;

    my $ORACLE_HOME = '/u01/oracle';
    my $ORACLE_SID = 'orcl';
    my $PATH = $ENV{PATH};

    my $user;
    my $passwd;
    my $ora_conn;

    $ENV{ORACLE_HOME} = $ORACLE_HOME;
    $ENV{ORACLE_SID} = $ORACLE_SID;
    $ENV{PATH} = "$ORACLE_HOME/bin:$PATH";
    $EVN{LD_LIBRARY_PATH} = "$ORACLE_HOME/lib:$LIBPATH";

    $user = "u01";
    $passwd = "u01";
    $ora_conn = "$user/$passwd\@morewood";

    system("./drop_object.sh $ora_conn $user > /dev/null 2>\&1 &");
    print "......Delete Done!......\n";

    sleep(2);

    system("imp $user/$passwd file=$user.dmp full=y buffer=10485760 ignore=Y log=$user.log &");
    print "......Import Done!......\n";

    exit


     --------------------------------------------------------

    #!/bin/sh
    #name drop_object.sh
    sqlplus -s << EOF
    $1
    set pages 0;
    set term off;
    set feedback off;
    spool /tmp/dropobj.$2.sql
    select 'alter session set recyclebin=off;' from dual;
    select 'drop ' || object_type || ' ' ||  object_name || ';' from user_objects where object_type = 'TABLE';
    select 'drop ' || object_type || ' ' || object_name || ';' from user_objects where object_type ='INDEX';
    spool off
    @/tmp/dropobj.$2.sql
    exit
    EOF
    #
    exit

  • 相关阅读:
    [转]Dokuwiki使用感受
    [转]认识与入门Markdown
    [转]2015深度学习回顾:ConvNet、Caffe、Torch及其他
    [转]Dokuwiki插件与主题推荐
    [转]okuwiki布署小记
    PHP环境配置
    keydown和keypress
    JavaScript优化参考
    IE兼容性标签和条件注释
    nodejs 简单http 文件上传demo
  • 原文地址:https://www.cnblogs.com/alang85/p/2552921.html
Copyright © 2011-2022 走看看