8/1/12

TRIỂN KHAI THIẾT LẬP CSDL SỬ DỤNG ORACLE


1.1.1.     TRIỂN KHAI THIẾT LẬP CSDL SỬ DỤNG ORACLE

Tạo cơ sở dữ liệu.

a)   Login vào user trong Oracle và nhập vào lệnh "dbca", nhấn "Next" để tiếp tục


b)  Chọn "Create Database" và nhấn next


c)   Chọn "General Purpose ***" và tiếp tục


d)  Nhập tên Grobal Database và SID như bên dưới.


e)   Giữ giá trị mặc định và tiếp tục


f)    Nhập passwords. Nên nhập mật khẩu có tính bảo mật cao


g)   Giữ giá trị mặc định là "File System".


h)  Configure recovery settings. If you'd like to change it, Set it.


i)    Configure sample schema and scripts. If you'd like to add them, Set them.


j)    Configure memory setting. After setting, go to next tab.


k)  Specify max processes.


l)    Set Character setting.


m)Select connection mode. If your server does not have many clients, Select Dedicated server mode. If your server has many clients, Select Shared server mode.


n)  Confirm parameters for Storage settings. If you'd like to change, set them.


o)  Configuration completed. Click "Finish" button to finish.


p)  Confirm settings and Click "OK" if all are OK.


q)  Database creation starts.


r)    Sau khi cơ sở dữ liệu tạo xong nhân "Exit" để hoàn thành.


s)   Access to a URL that is shown on finished screen above with web browser, then follwing screen is shown. Input a user name and password that you configured on the section

Create a init Script make Oracle start automatically on system booting.

t)     Change like folows first.
[root@db01 ~]#vi /etc/oratab
db01:/usr/oracle/app/product/11.2.0/dbhome_1:Y# change
[root@db01 ~]#vi /usr/oracle/.bash_profile
# add your SID at the last line
export ORACLE_SID=db01
u)   Create a init Script

[root@db01 ~]#vi /etc/rc.d/init.d/oracle
# this is an example
#!/bin/bash
# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/usr/oracle/app/product/11.2.0/dbhome_1
ORACLE_USER=oracle
case "$1" in
'start')
   if [ -f $LOCKFILE ]; then
      echo $0 already running.
      exit 1
   fi
   echo -n $"Starting Oracle Database:"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
   touch $LOCKFILE
   ;;
'stop')
   if [ ! -f $LOCKFILE ]; then
      echo $0 already stopping.
      exit 1
   fi
   echo -n $"Stopping Oracle Database:"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
   rm -f $LOCKFILE
   ;;
'restart')
   $0 stop
   $0 start
   ;;
'status')
   if [ -f $LOCKFILE ]; then
      echo $0 started.
      else
      echo $0 stopped.
   fi
   ;;
*)
   echo "Usage: $0 [start|stop|status]"
   exit 1
esac
exit 0

[root@db01 ~]#chmod 755 /etc/rc.d/init.d/oracle
[root@db01 ~]#/etc/rc.d/init.d/oracle start
Starting Oracle Database:
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-JUL-2011 23:41:57
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Starting /usr/oracle/app/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /usr/oracle/app/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /usr/oracle/app/diag/tnslsnr/db01/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db01.serverlinux)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db01.serverlinux)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                12-JUL-2011 23:41:57
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /usr/oracle/app/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /usr/oracle/app/diag/tnslsnr/db01/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db01.serverlinux)(PORT=1521)))
The listener supports no services
The command completed successfully
Processing Database instance "db01": log file /usr/oracle/app/product/11.2.0/dbhome_1/startup.log
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://db01.serverlinux:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ........ started.
-----------------------------------------------------------
Logs are generated in directory /usr/oracle/app/product/11.2.0/dbhome_1/db01.serverlinux_db01/sysman/log

[root@db01 ~]#chkconfig --add oracle
[root@db01 ~]#chkconfig oracle on

Bài đăng phổ biến