OracleDB: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Zeile 7: | Zeile 7: | ||
= User anlegen = | = User anlegen = | ||
<pre>#! /bin/bash | <pre>#! /bin/bash | ||
if [ "$ | if [ "$1" = "" ] ; then | ||
echo "usage create_user <user> <password>" | echo "usage create_user <user> [<password>]" | ||
else | else | ||
CODE=$2 | |||
test -z "$CODE" && CODE=$1 | |||
test -d "$ORACLE_HOME" || export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe | test -d "$ORACLE_HOME" || export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe | ||
test -z "$ORACE_SID" || export ORACLE_SID=xe | test -z "$ORACE_SID" || export ORACLE_SID=xe | ||
SCRIPT=/tmp/_create_user.inp | SCRIPT=/tmp/_create_user.inp | ||
test -f $SCRIPT && rm -rf $SCRIPT | test -f $SCRIPT && rm -rf $SCRIPT | ||
echo "CREATE USER $1 IDENTIFIED BY | echo "CREATE USER $1 IDENTIFIED BY "$CODE" QUOTA 50M ON SYSTEM;" >>$SCRIPT | ||
echo "GRANT CREATE SESSION TO $1;" >>$SCRIPT | echo "GRANT CREATE SESSION TO $1;" >>$SCRIPT | ||
sqlplus "SYS/SYS AS SYSDBA" < $SCRIPT | echo "GRANT CREATE table TO $1;" >>$SCRIPT | ||
echo "quit" >>$SCRIPT | |||
sqlplus "SYS/SYS@xe AS SYSDBA" < $SCRIPT | |||
rm -rf $SCRIPT | |||
fi | fi |
Version vom 14. Februar 2017, 21:12 Uhr
Installation Oracle XE 11g
- Minimum: 2G Swap, Paket: bc muss existieren
- Als root: /etc/init.d/oracle-xe configure
- service oracle-xe start
User anlegen
#! /bin/bash if [ "$1" = "" ] ; then echo "usage create_user <user> [<password>]" else CODE=$2 test -z "$CODE" && CODE=$1 test -d "$ORACLE_HOME" || export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe test -z "$ORACE_SID" || export ORACLE_SID=xe SCRIPT=/tmp/_create_user.inp test -f $SCRIPT && rm -rf $SCRIPT echo "CREATE USER $1 IDENTIFIED BY "$CODE" QUOTA 50M ON SYSTEM;" >>$SCRIPT echo "GRANT CREATE SESSION TO $1;" >>$SCRIPT echo "GRANT CREATE table TO $1;" >>$SCRIPT echo "quit" >>$SCRIPT sqlplus "SYS/SYS@xe AS SYSDBA" < $SCRIPT rm -rf $SCRIPT fi