#!/bin/sh

# configureTablespaceAndUser - run sql to create tablesspace and configure user for Oracle
# This script takes 6 arguments as follows:
# argument no. 1:  password for SYS user, that you specified when you created the database,
# argument no. 2:  db_instance_name
# argument no. 3:  default_tablespace_name 
# argument no. 4:  Datafile_name, for example, see2022.dbf
# argument no. 5:  user_name
# argument no. 6:  user_pwd

if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" -o -z "$5" -o -z "$6" -o $# -gt 6 ]; then
    echo '-------------------------------------------------'
    echo 'Create Tablespace'
    echo '-------------------------------------------------'
    echo 'usage: configureTablespaceAndUser requires exactly 6 arguments in the following sequence:'
	echo 'arg #1:  password for SYS user, that you specified when you created the database'
	echo 'arg #2:  db_instance_name'
	echo 'arg #3:  default_tablespace_name '
	echo 'arg #4:  Datafile_name, for example, see2022.dbf'
	echo 'arg #5:  user_name'
	echo 'arg #6:  user_pwd'
	echo 'For example: ./configureTablespaceAndUser sys_pwd see2022 fiper_ts SEE.dbf user1 user_pwd'
    echo '-------------------------------------------------'
    exit 1
else
    sqlplus -L "SYS/$1@$2" AS SYSDBA @configureTablespaceAndUser.sql "$3" "$4" "$5" "$6"> configureTablespaceAndUser.log
fi


