[root@oracledb ~]# hostname
oracledb
[root@oracledb ~]#
[root@oracledb ~]# vi /etc/hosts
[root@oracledb ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:E7:97:A3
inet addr:192.168.1.8 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fee7:97a3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:306 errors:0 dropped:0 overruns:0 frame:0
TX packets:202 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:32272 (31.5 KiB) TX bytes:24144 (23.5 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:720 (720.0 b) TX bytes:720 (720.0 b)
[root@oracledb ~]# vi /etc/hosts
[root@oracledb ~]# hostname
oracledb
[root@oracledb ~]# hostname
oracledb
[root@oracledb ~]# sed -i “s/SELINUX=enforcing/SELINUX=disabled/” /etc/selinux/config
[root@oracledb ~]# setenforce 0
[root@oracledb ~]# yum -y install gcc gcc-c++ make binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-commonglibc-devel libaio libaio-devel libgcclibstdc++ libstdc++-devel unixODBC unixODBC-devel
[root@oracledb ~]# sysctl -p
[root@oracledb ~]# groupadd -g 200 oinstall
[root@oracledb ~]# groupadd -g 201 dba
[root@oracledb ~]# useradd -u 440 -g oinstall -G dba oracle
[root@oracledb ~]# passwd oracle
[root@oracledb ~]# vi /etc/sysctl.conf
net.ipv4.ip_local_port_range= 9000 65500
fs.file-max = 6815744
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
fs.aio-max-nr = 1048576
[root@oracledb ~]# vi /etc/pam.d/login
session required pam_namespace.so
session required pam_limits.so
vi /etc/profile
if [ $USER =”oracle” ]; then
if [ $SHELL = “/bin/ksh” ];then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
[root@oracledb ~]# mkdir /opt/oracle/app/
[root@oracledb ~]# mkdir /opt/oracle/oradata/
[root@oracledb ~]# chmod 755 /opt/oracle/
[root@oracledb ~]# chmod 775 /opt/oracle/app/
[root@oracledb ~]# chown oracle.oinstall -R /opt/oracle/
[oracle@oracledb ~]$ vi ~/.bash_profile
export ORACLE_BASE=/opt/oracle/app
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_PID=orcl
working one
ORACLE_BASE=/opt/oracle/app/oracle;
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;
ORACLE_SID=orcl;
LD_LIBRARY_PATH=$ORACLE_HOME/lib;
PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin;
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH;
[oracle@oracledb ~]$ source .bash_profile
# vi /etc/rc.d/init.d/oracle
Oracle
#! /bin/bash
# chkconfig: 234 61 61
# description: Oracle 11g AutoRun Service
# /etc/rc.d/init.d/oracle
case “$1” in
start)
# starts oracle listener and instance
echo “Starting Oracle Database:”
su – oracle -lc “lsnrctl start”
su – oracle -lc dbstartup
;;
stop)
# shutdown oracle listner and instance
echo “Shuting down Oracle Database:”
su – oracle -lc “lsnrctl stop”
su – oracle -lc dbshutdown
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo “Usage: {start|stop|reload|restart}”
exit 1
esac
exit 0
dbstart dbshut
2?dbstartup dbshutdown
$ vi $ORACLE_HOME/bin/dbstartup
#dbstartup
#/opt/oracle/102/bin
sqlplus / as sysdba <<EOF
startup
exit
EOF
vi$ORACLE_HOME/bin/dbshutdown
#dbshutdown
#/home/oracle/102/bin
sqlplus / as sysdba <<EOF
shutdown immediate
exit
EOF
3?
# cd /etc/rc.d/init.d
# ./oracle start
# ./oracle stop
4?oracle
# chmod 750 /etc/rc.d/init.d/oracle
# chkconfig –level 234 oracle on
# chkconfig –add oracle
[root@oracledb software]# unzip linuxamd64_12102_database_1of2.zip
[root@oracledb software]# unzip linuxamd64_12102_database_2of2.zip
[root@oracledb~]# xhost +
[root@oracledb~]# su – oracle
[root@oracledb~]# ./software/database/runinstaller
[root@oracledb CVU_11.2.0.1.0_oracle]# sh runfixup.sh
Response file being used is :./fixup.response
Enable file being used is :./fixup.enable
Log file location: ./orarun.log
Setting Kernel Parameters…
The value for semopm in response file is not greater than value for semopm in /etc/sysctl.conf file. Hence not changing it.
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
The value for file-max in response file is not greater than value for file-max in /etc/sysctl.conf file. Hence not changing it.
fs.file-max = 6815744
The upper limit of ip_local_port range in reponse file is not greater than value in /etc/sysctl.conf, hence not changing it.
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=262144
The value for rmem_default in response file is not greater than value for rmem_default in /etc/sysctl.conf file. Hence not changing it.
net.core.rmem_default = 262144
net.core.wmem_default=262144
The value for wmem_default in response file is not greater than value for wmem_default in /etc/sysctl.conf file. Hence not changing it.
net.core.wmem_default = 262144
net.core.rmem_max=4194304
The value for rmem_max in response file is not greater than value for rmem_max in /etc/sysctl.conf file. Hence not changing it.
net.core.rmem_max = 4194304
net.core.wmem_max=1048576
The value for wmem_max in response file is not greater than value for wmem_max in /etc/sysctl.conf file. Hence not changing it.
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
The value for aio-max-nr in response file is not greater than value for aio-max-nr in /etc/sysctl.conf file. Hence not changing it.
fs.aio-max-nr = 1048576
[root@oracledb CVU_11.2.0.1.0_oracle]#yum install libaio* glibc* compat-libstdc* libaio-devel* libgcc* libstc++* unixoDBC* pdksh*
download the url from
http://mirror.centos.org/centos/6.5/os/i386/Packages/
http://mirror.centos.org/centos/6.5/os/i386/Packages/
wget http://mirror.centos.org/centos/6.5/os/i386/Packages/libaio-0.3.107-10.el6.i686.rpm
wget http://mirror.centos.org/centos/6.5/os/i386/Packages/libaio-devel-0.3.107-10.el6.i686.rpm
wget http://mirror.centos.org/centos/6.5/os/i386/Packages/compat-libstdc++-33-3.2.3-69.el6.i686.rpm
wget http://mirror.centos.org/centos/6.5/os/i386/Packages/libgcc-4.4.7-4.el6.i686.rpm
wget http://mirror.centos.org/centos/6.5/os/i386/Packages/libstdc++-4.4.7-4.el6.i686.rpm
wget http://mirror.centos.org/centos/6.5/os/i386/Packages/unixODBC-2.2.14-12.el6_3.i686.rpm
wget http://mirror.centos.org/centos/6.5/os/i386/Packages/unixODBC-devel-2.2.14-12.el6_3.i686.rpm
yum install libaio*
yum install libaio* glibc* compat-libstdc*
yum install libaio* glibc* compat-libstdc* libaio-devel* libgcc* libstc++* unixoDBC* pdksh*
yum install libgcc* libstc++* unixoDBC* pdksh*
yum search unixODBC
yum install libgcc* libstc++* unixODBC* pdksh*
yum install libgcc++*
yum search PDF
yum search pdksh
yum install mksh
yum search unixODBC*
yum search unixODBC
yum install unixODBC-devel.i686 unixODBC-devel.x86_64 unixODBC.i686 unixODBC.x86_64
rpm -ivh compat-libstdc++-33-3.2.3-69.el6.i686.rpm
rpm -ivh libaio-0.3.107-10.el6.i686.rpm
rpm -ivh libaio-devel-0.3.107-10.el6.i686.rpm
rpm -ivh libstdc++-4.4.7-4.el6.i686.rpm
80 yum remove libstdc++
81 rpm -ivh libstdc++-4.4.7-4.el6.i686.rpm
82 ls
83 yum remove unixODBC
84 ls
85 rpm -ivh unixODBC-2.2.14-12.el6_3.i686.rpm unixODBC-devel-2.2.14-12.el6_3.i686.rpm
Oracle common commands
[root @ oracledb ~] # su -oracle
[oracle @ oracledb ~] # sqlplus / as sysdba
SQL> startup # Start the database instance
SQL> shutdown immediate # close the database instance
SQL> select * from tab; # View all the tables
SQL> select name from v$datafile; # view database storage directory
SQL> show parameter service # View service name
SQL> select * from v$instance; # View instance name
SQL> select name from v$database; # Check the database name
SQL> select * from dba_users; # view all user information
SQL> select username, password from dba_users; # only query the user and password
SQL> select * from v$pwfile_users; # View user with sysdba privileges
SQL> select * from dba_ustats; # view the current user information
SQL> select * fromuser_sys_privs # view the permissions of the current user’s system
SQL> select * fromuser_role_privs # view the current user role
SQL> select * fromdba_sys_privs # View system permissions for the specified user has
SQL> select * from v$version; # View oracle version
SQL> select * fromuser_views # View View Information
SQL> show user
USER is “SYS”
SQL> select banner from v$version;
BANNER
——————————————————————————–
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
PL/SQL Release 11.2.0.1.0 – Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 – Production
NLSRTL Version 11.2.0.1.0 – Production
[root @ oracledb ~] # lsnrctl start # turn on the remote listening port
### Remote connection information
oracle user
#sys and system users difference
Different 1> the importance of storing data
sys to store the data dictionary base tables and views, maintained by the database itself, any user can manually change, sys user owns dba, sysdba, sysoper other roles or privileges, is the highest authority oracle user.
The system users only store some level of internal data, such as management information oracle of some features or tools. For database management, System users have ordinary dba role permissions.
2> Different permissions
sysoper sys user with sysdba or system privileges, log em can only use these two identities, can not use normal.
system user can log on em with normal identity, unless you have it granted sysdba system privileges or syspoer system privileges.
#sysdba and sysoper difference between the two systems permissions
normal ordinary users
sysdba has the highest system privileges, log is sys
sysoper mainly used to start, shut down the database login user is public after sysoper
The difference #dba and sysdba
First understand the process of creating the next oracle service: Create an instance -> Start Instance -> Create Database
Startup process: Example start -> Load Database -> Open Database
sysdba is to manage the oracle instance, its existence does not depend on the entire database is fully activated, as long as the instance starts up, it already exists as sysdba login, load the database, open the database. Only the database is open, or the entire database completely after starting, dba role only exists foundation.
Recent Comments