婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識(shí)庫 > shell腳本操作oracle刪除表空間、創(chuàng)建表空間、刪除用戶

shell腳本操作oracle刪除表空間、創(chuàng)建表空間、刪除用戶

熱門標(biāo)簽:華鋒e路航港口地圖標(biāo)注 客服外呼系統(tǒng)怎么樣 打電話機(jī)器人接我是他的秘書 江蘇云電銷機(jī)器人公司 地圖標(biāo)注員都是年輕人 揭陽智能電話機(jī)器人推薦 河南信譽(yù)好的不封卡電話外呼系統(tǒng) 百度地圖標(biāo)注錯(cuò)了有責(zé)任嗎 如果做線上地圖標(biāo)注

oracle下表空間的導(dǎo)出,用戶的刪除,表空間刪除,用戶新建,表空間新建,數(shù)據(jù)導(dǎo)入的shell
使用非oracle用戶執(zhí)行該腳本
參數(shù)說名
$1:base表空間的用戶名
$2:同步表空間的用戶名
使用場景
測試用,base表空間用于升級(jí)建立一些固化數(shù)據(jù)。同步表空間用于測試用,每次去和base表空間拉平數(shù)據(jù)

復(fù)制代碼 代碼如下:

#!/bin/sh
oraclehome=$ORACLE_HOME
echo $oraclehome
localdir="/oracle/data"
echo $localdir
#刪除已經(jīng)存在的臨時(shí)dmp文件
rm -rf $localdir/$2temp.dmp
rmresult=$?
echo "rm $2temp.dmp result:$rmresult"
#將用戶$1的表空間導(dǎo)出
su - oracle -c "exp dba/dba file=$localdir/$2temp.dmp owner=$1"
expresult=$?
if [ "$expresult" != "0" ];then
        echo "exp $1 tablespace failure!!!"
fi
#先刪除用戶$2及其表空間,然后再新建該用戶及表空間
su - oracle -c "${ORACLE_HOME}/bin/sqlplus /nolog" EOF
connect / as sysdba
drop user $2 cascade;
drop tablespace $2 including contents and datafiles;
create tablespace $2 datafile '/oracle/product/10.2.0/oradata/$2.dbf' size 5M autoextend on;
create user $2 identified by "$2" default tablespace $2 temporary tablespace TEMP profile DEFAULT;
grant connect to $2;
grant resource to $2;
grant create any table to $2;
grant create any trigger to $2;
grant create any type to $2;
grant create any view to $2;
grant unlimited tablespace to $2;
exit
EOF

crdrresult=$?
if [ "$crdrresult" != "0" ];then
        echo "drop user and tablespace failure!!!"
        echo "create user and tablespace failure!!!"
else
#剛建完的用戶不能馬上使用,等候10秒
        sleep 10s
#更換dmp文件中的表空間名
        sed -i 's/TABLESPACE "$1"/TABLESPACE "$2"/g' $localdir/$2temp.dmp
#使用imp命令導(dǎo)出表空間數(shù)據(jù)到用戶$2的表空間
        su - oracle -c "imp dba/dba file=$localdir/$2temp.dmp  fromuser=$1 touser=$2"
        impresult=$?
        if [ "$impresult" != "0" ];then
                echo "imp failure!!!"
        else
                echo "imp success!!!"
        fi
fi

您可能感興趣的文章:
  • 使用sqlplus命令行工具為oracle創(chuàng)建用戶和表空間
  • oracle創(chuàng)建表空間、授權(quán)、創(chuàng)建用戶、導(dǎo)入dmp文件
  • Oracle 刪除用戶和表空間詳細(xì)介紹
  • Linux下Oracle刪除用戶和表空間的方法
  • Oracle新建用戶、角色,授權(quán),建表空間的sql語句
  • Oracle數(shù)據(jù)庫的實(shí)例/表空間/用戶/表之間關(guān)系簡單講解

標(biāo)簽:婁底 馬鞍山 許昌 邵陽 赤峰 巴彥淖爾 淘寶邀評(píng) 金昌

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《shell腳本操作oracle刪除表空間、創(chuàng)建表空間、刪除用戶》,本文關(guān)鍵詞  shell,腳本,操作,oracle,刪除,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《shell腳本操作oracle刪除表空間、創(chuàng)建表空間、刪除用戶》相關(guān)的同類信息!
  • 本頁收集關(guān)于shell腳本操作oracle刪除表空間、創(chuàng)建表空間、刪除用戶的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 正宁县| 汽车| 乃东县| 陕西省| 镶黄旗| 苍南县| 浦城县| 罗城| 浪卡子县| 辛集市| 汉源县| 云和县| 吉首市| 湘西| 无极县| 济南市| 芜湖市| 松溪县| 吉首市| 兴宁市| 海南省| 大庆市| 焦作市| 修武县| 台南县| 宾阳县| 张家港市| 宝应县| 仲巴县| 红原县| 读书| 武城县| 仪陇县| 德令哈市| 探索| 辽阳县| 中西区| 塔城市| 新营市| 眉山市| 蛟河市|