1、创建用户—脱敏处理过,隐藏用户和密码
#!/bin/bash
echo -e "\e[0;33m ****************************************************************** \e[0m"
echo " 功能:(1)dba 登陆切换到目标pdb (2)先创建添加ky表空间和增加表空间文件(默认为3个datafile)"
echo " 功能:(3)创建cy、zkv、rta、Ab账户 (4)账户权限管理"
echo -e "\e[0;33m ****************************************************************** \e[0m"
dbfdir=/usr/oracle/oradata/orcl/
whichpdb=PDBORCL
outfiletmp01=$PWD/createusertmp01.txt #specify the output file location
outfiletmp02=$PWD/createusertmp02.txt #specify the output file location
outfiletmp03=$PWD/createusertmp03.txt #specify the output file location
###########################################################################
#判断/usr/oracle/oradata/orcl是否存在
###########################################################################
if [ ! -d "$dbfdir" ];then
mkdir $dbfdir
echo -e "\e[0;32m ****************************************************************** \e[0m"
echo " $dbfdir 创建成功,可以进行创建 tablespace 操作!"
echo -e "\e[0;32m ****************************************************************** \e[0m"
else
echo -e "\e[0;32m ****************************************************************** \e[0m"
echo " $dbfdir 已经存在,可以进行创建 tablespace 操作!"
echo -e "\e[0;32m ****************************************************************** \e[0m"
fi
###########################################################################
#1、dba 登陆切换到目标pdb
###########################################################################
lsnrctl start;
sqlplus -S "/ as sysdba" <<!01 >/dev/null #禁止sqlplus执行结果回显
set heading off;
set feedback off;
set termout off;
set pagesize 20;
set verify off;
set echo off;
spool ${
outfiletmp01}
alter pluggable database $whichpdb open;
alter session set container=$whichpdb;
startup
spool off
exit;
!01