works fine in 10g not in 11g
vi schema_export.sh
----------------------------
#!/bin/ksh
. /home/oracle/.profile
SYSTEMPWORD=`cat /home/oracle/cronjobs/.systempword`
export ORACLE_SID=testdb
##echo $SYSTEMPWORD $ORACLE_HOME/bin/exp@proddb system \exp system/password@proddb \owner=schema file=/orabkup/refresh/testdb/schema_refresh.dmp compress=n statistics=none consistent=y buffer=1024000 log=/orabkup/refresh/testdb/schema_import.log
/bin/mailx -s "schema REFRESH exports complete" myemail@gmail.com < /dev/null
exit
vi drop_create_user.sql
----------------------------------
spool drop_create_user.log
drop user schema cascade;
CREATE USER schema IDENTIFIED BY VALUES 'password' DEFAULT TABLESPACE tbsname
TEMPORARY TABLESPACE TEMP QUOTA UNLIMITED ON tbsname QUOTA UNLIMITED ON tbsname
PROFILE DEFAULT
ACCOUNT UNLOCK
/
GRANT "CONNECT" TO schema WITH ADMIN OPTION
/
GRANT DBA TO schema
/
GRANT "RESOURCE" TO schema
/
GRANT ROLE TO schema WITH ADMIN OPTION
/
ALTER USER schema DEFAULT ROLE "CONNECT", DBA, "RESOURCE", ROLE
/
GRANT CREATE USER TO schema WITH ADMIN OPTION
/
GRANT UNLIMITED TABLESPACE TO schema
/
GRANT CREATE ROLE TO schema WITH ADMIN OPTION
/
spool off
exit
vi coalesce_tablespace.sql
---------------------------------------
spool coalesce_tablespace.log
ALTER TABLESPACE tbsname COALESCE
/
ALTER TABLESPACE tbsname COALESCE
/
spool off
exit
vi siebel_import.sh
------------------------------
#!/bin/ksh
. /home/oracle/.profile
export ORACLE_SID=testdb
cd /home/oracle/REFRESH/testdb/
rm drop_create_user.log
rm coalesce_tablespace.log
$ORACLE_HOME/bin/sqlplus "/ as sysdba" << EOF1@drop_create_user.sql
quit
EOF1
$ORACLE_HOME/bin/sqlplus "/ as sysdba" << EOF2@coalesce_tablespace.sql
quit
EOF2
imp system/password file=/orabkup/refresh/testdb/schema_refresh.dmp log=/orabkup/refresh/testdb/schema_import.log fromuser=schema touser=schema rows=y indexes=y grants=y buffer=1024000 STATISTICS=none
/bin/mailx -s "IMPORT REFRESH schema COMPLETED" myemail@gmail.com < /dev/null
exit
crontab -e
-----------------
01 10 14 06 * /home/oracle/REFRESH/testdb/schema_export.sh &
46 11 14 06 * /home/oracle/REFRESH/testdb/schema_import.sh &
No comments:
Post a Comment