School of Computer Science & Software Engineering University of Wollongong Session: October 2015 Lecturer: Janusz R. Getta Installation and management of Oracle 11g Express Edition Release 2 5 October 2015 Objectives This specification explains how to install Oracle 11g Release 2 on Windows 7 system, how to start and stop a database, and how to use SQL*Plus client. Installing the system To install the system, perform the following steps. (0) Copy a file OracleXE112_Win32.zip from CSCI315 folder located on your CSCI315 DVD to the Desktop on your computer. (1) Unzip a file OracleXE112_Win32.zip to OracleXE112_Win32 on the Desktop of your computer. (2) Open a folder OracleXE112_Win32. Open a folder DISK1. (3) Start setup.exe. The system should start InstallShield Wizard. It takes a minute or two while the system prepares to install. Wait until the system opens a windows “Oracle Database 11g Express Edition – Install Wizard”. (4) When the preparations are finished, click at Next> button in a window “Oracle Database 11g Express Edition – Install Wizard”. (5) Pick “I accept the terms in the license agreement” and click at Next> button. (6) Choose a destination location (you may accept a destination location proposed by Oracle Installer) and click at Next> button. (7) Type in a password for both SYSTEM and SYS users. A password is up to you. It should be a string of characters that must start from a letter and it is a combination of letters and digits. When both passwords for SYSTEM and SYS users are typed in, click at Next> button. (8) Read information provided in a summary and if everything is all right, click at Install button. The system should open a window Oracle Database 11g Express Edition – Install Wizard and start the installation. The installation a folder procedure will run for few minutes. Wait until the system displays a message “Install Shield Wizard Complete”. (9) Click at Finish button. (10) Shutdown and restart an operating system. (11) The system should display an icon "Get Started with Oracle Database 11g Express Edition". Click at the icon. The system starts a default Web browser and opens HTML document with information about the parameters and the present state of "Oracle Database XE 11.2". Browse the document. At the moment you do not need to perform any of the actions described in the document. Close Web browser and perform the actions described in the next section of this document. Stopping/Starting the system Oracle 11g XE server should be up and running now. (0) To shutdown Oracle XE server, navigate through START->All Programs>Oracle Database 11g Express Edition->Stop Database. Leftclick at Stop Database. The system opens Stop Database command window and stops OracleServiceXE service. You should get the messages: The OracleServiceXE service is stopping ..... The OracleServiceXE service was stopped successfully. To stop a listener execute the following command in a command window: lsnrctl stop The system should display a message: The command completed successfully. Close a command window. (1) To startup the system, navigate through START->All Programs->Oracle Database 11g Express Edition->Start Database. Leftclick Start Database. The system opens Start Database command window. The system should display the following messages: The The The The OracleXETNSListener service is starting. OracleXETNSListener was started successfully. OracleServiceXE service is starting..... OracleServiceXE was started successfully. Close a command window. Starting SQL*Plus client (method 1) To start SQL*Plus client and to connect as a user SYSTEM perform the following steps. (0) Find a folder XE in CSCI315 folder on your CSCI315 DVD. Copy a folder XE into drive C:. (1) Navigate through START->All Programs->Oracle Database 10g Express Edition->Run SQL Command Line. Rightclick (!)Run SQL Command Line. (2) Select Properties. (3) Type: C:\XE into “Start in” field. In this way you determine a location of your SQL scripts each time SQL*Plus client is started. Leftclik OK button. Note, that you do not have to perform this step (3) when running SQL*Plus client the next time. (4) Navigate through START->All Programs->Oracle Database 10g Express Edition->Run SQL Command Line. Leftclick Run SQL Command Line. At SQL> prompt type: connect system to connect as a user SYSTEM. (5) Type a password of a user SYSTEM. It is a password you entered in a step (7) of Installation procedure. The system should reply with a message: Connected. and with SQL> prompt in the next line. (6) We would like to run SQL script that lists the names of files and tablespaces an Oracle database consists of. To do so type: @sf at SQL> prompt and press Enter key. The system should list the names of tablespaces, the paths and names of files the tablespaces consist of, internal file identifiers, and size of files in bytes. At the moment a database consists of four tablespaces: USERS, SYSAUX, UNDO, SYSTEM. You may have to expand a Command line window to get a nice and clear output. (7) To disconnect from SQL*Plus type: exit Comment: To connect as user anyuser you may also execute: connect anyuser instead of connect system. A connect command of SQL*Plus allows you to connect as another user without closing SQL*Plus client. It is explained below how to create a new user account, e.g. anyuser. Starting SQL*Plus client (method 2) To start SQL*Plus client perform the following steps. (0) Navigate through START->All Programs->Accessories->Command Prompt, leftclick Command Prompt. (1) Use cd command to move to a directory that contains your SQL scripts, i.e to move to a directory XE execute a command: cd c:\XE (2) Execute a command: sqlplus /nolog A command sqlplus /nolog starts SQL*Plus client and does not connect a client as any user. (3) Type at SQL> prompt: connect system to connect as a user SYSTEM. (4) Type a password of a user SYSTEM. It is a password you entered in a step (7) of Installation procedure. The system should reply with a message: Connected. and with SQL> prompt in the next line. (5) We would like to run SQL script that lists the names of files and tablespaces an Oracle database consists of. To do so type: @sf at SQL> prompt and press Enter key. The system should list the names of tablespaces, the paths and names of files the tablespaces consist of, internal file identifiers, and size of files in bytes. At the moment a database consists of four tablespaces: USERS, SYSAUX, UNDO, SYSTEM. You may have to expand a Command line window to get a nice and clear output. (6) To disconnect from SQL*Plus type: exit Next, close a Command line window. Comment: To connect as user anyuser you may also execute: connect anyuser instead of connect system. A connect command of SQL*Plus allows you to connect as another user without closing SQL*Plus client. It is explained below how to create a new user account, e.g. anyuser. Creating a new user To create a new user, perform the following steps. (0) Start SQL*Plus client using either method 1 or method 2 explained above. (1) Connect as a user SYSTEM. (2) Assume, that we would like to create a new user QQQ with a password PSSST. At SQL> prompt execute a command: CREATE USER QQQ IDENTIFIED BY PSSST; (3) Next, we have to grant the functional privileges to the user. At SQL> prompt execute a command: GRANT RESOURCE,CONNECT TO QQQ; (4) To connect as a user QQQ execute at SQL> prompt: connect QQQ (5) Type in a password (PSST). (6) We would like to run again SQL script that lists the names of files and tablespaces an Oracle database consists of. To do so type: @sf at SQL> prompt and press Enter key. The system should reply with a message: SET ECHO OFF FROM DBA_DATA_FILES * ERROR at line 5: ORA-00942: table or view doest not exist The error message above means that user QQQ has no rights to access a data dictionary relational view DBA_DATA_FILES that contains information about tablespaces and data files. At the moment, only the users SYSTEM and SYS have the rights to access DBA_DATA_FILES. It is explained in the laboratory classes how to grant to a user the data access rights and functional access rights. Dropping a user To drop a user, perform the following steps. (0) If SQL*Plus client is not started then start SQL*Plus client using either method 1 or method 2 explained above. (1) Connect as a user SYSTEM. (2) At SQL> prompt execute a command: DROP USER QQQ CASCADE; You can find more information about the management of the system in the laboratory specifications. What to do next ? In the next step you have to create and to load data into a sample database. Open a file CreatingSampleDB.pdf and follow the instructions written there. End of specification