Merge branch 'master' of https://Governor-Tarkin@bitbucket.org/Governor-Tarkin/swg...
[swg-src.git] / ORACLE.md
blob599a0bd9608b890b8d3f6e7726efceb4a44186c3
1 # Oracle Database Server Build
3 Note: for Windows, you can also use the instant server, but this is the "right" way to do it.
5 * Download The Latest Version of Oracle Linux (can be 64 bit)
6 * Install it as you would any other distro
7 * For your non-root user, use the name oracle
8 * For ease of use, choose the install option with a desktop environment
10 * Can also install Oracle Server on Windows host if you know what you're doing
12 ## Initial Setup
14 From a root terminal:
15     
16     yum install oracle-rdbms-server-12cR1-preinstall
17     systemctl stop firewalld
18     systemctl disable firewalld
19     
20 ## Hostname
22 * Edit /etc/hostname and change it to something other than localhost
23 * Add an alias pointing 127.0.0.1 to the new hostname
24     
25 ## Download the latest Oracle Database zip files (should be 2)
27 * Unzip both, and run the installer as your normal oracle user
28 * Go through the process, setting the options where required, including the db name
29 * Make sure to name the database appropriately
30 * Make sure to specify the proper hostname of the machine you are running
32 ## Edit /etc/oratab
34 As root, change the "N" at the end of the last string to "Y"
36 ## Add some environment variables
38 Add to the bottom of /home/oracle/.bashrc:
40     export ORACLE_HOME=/home/oracle/app/oracle/product/12.1.0/dbhome_1
41     export PATH=$PATH:/home/oracle/app/oracle/product/12.1.0/dbhome_1/bin/
42     export ORACLE_SID=swg; #set this to the name you chose for your database/service
44 Reboot
46 ## Create /etc/init.d/dbora
48 Copy and pase the example below, but make sure to set the hostname and Oracle variables!
50     #! /bin/sh 
51     #
52     # Change the value of ORACLE_HOME to specify the correct Oracle home
53     # directory for your installation.
54     
55     ORACLE_HOME=/home/oracle/app/oracle/product/12.1.0/dbhome_1
56     #
57     # Change the value of ORACLE to the login name of the
58     # oracle owner at your site.
59     #
60     ORACLE=oracle
61     
62     PATH=${PATH}:$ORACLE_HOME/bin
63     HOST="oracle"
64     PLATFORM=`uname`
65     export ORACLE_HOME PATH
66     #
67     if [ ! "$2" = "ORA_DB" ] ; then
68           runuser $ORACLE  $0 $1 ORA_DB
69           if [ "$PLATFORM" = "Linux" ] ; then
70              touch /var/lock/subsys/dbora
71           fi
72           exit
73        fi
74     #
75     case $1 in
76     'start')
77             $ORACLE_HOME/bin/dbstart $ORACLE_HOME &
78             ;;
79     'stop')
80             $ORACLE_HOME/bin/dbshut $ORACLE_HOME &
81             ;;
82     *)
83             echo "usage: $0 {start|stop}"
84             exit
85             ;;
86     esac
87     #
88     exit
90 Then, make it executable:
91     
92     chmod +x /etc/init.d/dbora
94 ## Oracle Listener configuration
96 In /home/oracle/app/oracle/product/(some version number)/dbhome_1/network/admin edit 
97 both tnsnames.ora and listener.ora and change all mentions of "localhost" 
98 to the hostname you chose after installation.
100 ## Reboot and Start the Database
101 After rebooting, become root and execute:
103     /etc/init.d/dboracle start
105 ## Test the database locally on the DB server and connect for management
106     
107     sqlplus
108     
109 Login as SYSTEM using the password you set during installation.
111 ### Create user and grant privs
113         ALTER SESSION SET "_ORACLE_SCRIPT"=true;
114     CREATE USER remoteuser IDENTIFIED BY yourpasswordhere;
115     GRANT ALL PRIVILEGES TO remoteuser;
116     GRANT UNLIMITED TABLESPACE TO remoteuser;
118 ## Test connection from game server
120     sqlplus remoteuser/yourpasswordhere@oracle:1521/swg
122 ### Deleting/clearing tables for a fresh DB population
124     drop user username cascade;
126 Then recreate the user per the previous instructions.