Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write shell scripts to operate oracle delete tablespaces, create tablespaces, and delete users

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces "how to write shell script operation oracle delete table space, create table space, delete user" related knowledge, in the actual case operation process, many people will encounter such a dilemma, then let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

Export of table space under oracle, deletion of user, deletion of table space, user creation, table space creation, shell of data import

Execute the script using a non-oracle user

parameter name

$1: User name of base tablespace

$2: User name for synchronization tablespaces

usage scenarios

For testing, the base table space is used to upgrade and build some hardened data. Synchronous tablespaces are used for testing, flattening data each time you go to and base tablespaces

The code is as follows:

#!/ bin/sh

oraclehome=$ORACLE_HOME

echo $oraclehome

localdir="/oracle/data"

echo $localdir

#Delete existing temporary dmp files

rm -rf $localdir/$2temp.dmp

rmresult=$?

echo "rm $2temp.dmp result:$rmresult"

#Export User $1 Tablespace

su - oracle -c "exp dba/dba file=$localdir/$2temp.dmp owner=$1"

expresult=$?

if [ "$expresult" != "0" ];then

echo "exp $1 tablespace failure!!! "

fi

#Delete User $2 and its Tablespace before creating a new one

su - oracle -c "${ORACLE_HOME}/bin/sqlplus /nolog"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report