Oracle测试账户创建



#!/bin/bash
PDB=ORCLPDB2
export ORACLE_PDB_SID=ORCLPDB2
for x in {1..3}
do
sqlplus -S '/ as sysdba' <<EOF 

alter session set container=$ORCLPDB1

drop user DBA${x} cascade;

drop table tbs_0${x} including contents and datafiles;

create tablespace tbs_0${x} datafile size 1G autoextend on next 10m;

create user DBA${x} identified by DBA${x} DEFAULT TABLESPACE tbs_0${x} quota unlimited on tbs_0${x};

grant resource,connect to DBA${x};

grant select on sys.dba_objects to DBA${x};

conn DBA${x}/DBA${x}@${PDB};

create table T${x} as select * from dba_objects;

insert into  T${x} select * from dba_objects;

commit;

insert into  T${x} select * from dba_objects;

commit;

delete T${x} where rownum<30000;

commit;

exec DBMS_STATS.GATHER_TABLE_STATS('','T${x}');

exit;
exit;
EOF
done




posted @ 2023-08-20 19:12  DBAGPT  阅读(22)  评论(0编辑  收藏  举报