#!/bin/ksh
install_dir=`pwd`
echo "Please enter the SID of Database :/c"
read dbsid
read dbsid
echo "Please enter the password of the [system] user:/c"
read dbpwd
read dbpwd
nohup sqlplus
system/$dbpwd@$dbsid >/tmp/db_tablespace.out <<EOF
@oracle_xms_tablespace.sql;
@oracle_xms_user.sql;
exit
EOF
@oracle_xms_tablespace.sql;
@oracle_xms_user.sql;
exit
EOF
echo "The tablespaces and the users created successful."
echo "Please enter the password of the xms_admin user[ABC123]:/c"
read xmspwd
echo "Please enter the password of the xms_admin user[ABC123]:/c"
read xmspwd
nohup sqlplus
xms_admin/$xmspwd@$dbsid >/tmp/db_install.out <<EOF
@oracle_xms_tables.sql;
@oracle_xms_synonym.sql;
@oracle_xms_init_data.sql;
SET LINESIZE 500 FEEDBACK OFF TRIMSPOOL ON TERMOUT OFF HEAD OFF PAGESIZE 0 term off
SPOOL /tmp/db_info.txt
SELECT count(*) FROM xms_setup;
select count(*) from xms_setup where type=1;
select count(*) from xms_function;
select count(*) from xms_function_item;
select count(*) from xms_item;
select count(*) from xms_role;
select count(*) from xms_role_function;
select count(*) from xms_user;
select count(*) from xms_user_item;
select count(*) from xms_user_role;
select value from xms_setup where name='SYS_ADMIN';
SPOOL OFF
exit
EOF
@oracle_xms_tables.sql;
@oracle_xms_synonym.sql;
@oracle_xms_init_data.sql;
SET LINESIZE 500 FEEDBACK OFF TRIMSPOOL ON TERMOUT OFF HEAD OFF PAGESIZE 0 term off
SPOOL /tmp/db_info.txt
SELECT count(*) FROM xms_setup;
select count(*) from xms_setup where type=1;
select count(*) from xms_function;
select count(*) from xms_function_item;
select count(*) from xms_item;
select count(*) from xms_role;
select count(*) from xms_role_function;
select count(*) from xms_user;
select count(*) from xms_user_item;
select count(*) from xms_user_role;
select value from xms_setup where name='SYS_ADMIN';
SPOOL OFF
exit
EOF
echo "##########/n"
echo "DataBase install successful."
echo "##########/n"
echo "##########/n"
echo "Checking the data..."
./check_db.ksh </tmp/db_info.txt
./check_db.ksh </tmp/db_info.txt
echo "##########/n"
echo "Check database finished."
cd $install_dir
echo "Check database finished."
cd $install_dir