Upload
ksknrindian
View
224
Download
0
Embed Size (px)
Citation preview
8/10/2019 08 -Oracle 11g Arch Student
1/83
UNIX
UNIX Flavors:
Linux
CentOS
SUSE Linux
Redhat Linux
Oracle Enterprise Linux (OEL)
!"UNIX
Sun Solaris
I#$ %IX
!artitions:
& " root partition '# *+#
&,oot " #oot -les *++$#
&t.p " te.p-le(lo/ -les) '++$# 0#
S1ap " -le s2ste. 3 X R%$
SI4E
&opt " 5or Oracle ,inar2 *+#
&so5t1are " Oracle i.a/e '#
&data* " Oracle data 0+#
&,ac6up " Oracle data ,ac6ups *++#
Lo/in as root user:
7 root user
8 Other than root user
Server *&data&so5t1are&,ac6up
Server 3&data&so5t1are&,ac6up
Server n&data&so5t1are&,ac6up
S%N Stora/e &data &so5t1are &,ac6up
S1itch
1
8/10/2019 08 -Oracle 11g Arch Student
2/83
7 date
Fri $ar 39 +:30:;+ $S< 3+*+
7 1hoa.i
root
7 1ho
chope pts&+ %pr 3; *+:0; (shell=co.puterhope=co.)
.rhope pts&* %pr 3; *>:* (shell=co.puterhope=co.)
7 1ho ",
7 upti.e
*0:0:+? up *3 da2s@ 0'+>:*9hrs@ *+9 users@ load avera/e: +=*'
7 p1d
&ho.e&oracle
7 ls
a,c=txt x2A .ail=doc
7 ls "l
dr1BrB B rB B * oracle oinstall 9*3 Nov 3 *:9*
a,c=txt
Br1B rB BrB B * oracle oinstall 0+' Oct *> 3;:+
x2A
dr1BrB B rB B * oracle oinstall 9*3 Nov 3 *:9*
.ail=doc
r1x r1x r1x " 5ull per.ission
r " 0
1 " 3
x " *
7 ch.od ?'9 a,c=txt
7 ch.od R ?'9 .ail=doc
7 ch.od ?99 x2A
7 /roupadd .ca
7 useradd stanl2 "/ .ca
7 cho1n stanl2:.ca x2A
7 cho1n stanl2:.ca a,c=txt
7 cho1n "R stanl2:.ca .ail=doc
7 ls "l
2
8/10/2019 08 -Oracle 11g Arch Student
3/83
dr1xr"xr"x 3 oracle d,a ' $a2 ** 3+*+ **.Blo/s
"r1"r""r"" * oracle d,a *+*?? an 3> 3++ 0'>3>'*=txt
"r1"r""r"" * oracle d,a *??>> an 9 3++
9>9?;09=txt
"r1"r""r"" * oracle d,a *??+ Nov *3 3++> '>00?;=txt
7 ls "la
"r1""""""" * oracle d,a 9+ Oct 0 *':*'
=Xauthorit2
"r""r""r"" * oracle d,a >;* %pr 3+ 3++' =cshrc
dr1xr"xr"x 3 oracle d,a ' $a2 ** 3+*+ **.Blo/s
"r1"r""r"" * oracle d,a *+*?? an 3> 3++
0'>3>'*=txt
7 ls "lt
dr1xr"xr"x 3 oracle d,a 3+0>+++ Dec > +':+
undoBstats
"r1"r""r"" * oracle d,a ;*++' Dec > +':+'
lp.onBa/=lo/
"r1"r""r"" * oracle d,a '>+??> Dec 0 3++?
%+;0Bstandards
"r1"r""r"" * oracle d,a '3339 %pr *> 3++?
orahotBpar.B+*
7 ls "ltr
"r1"r""r"" * oracle d,a '3339 %pr *> 3++?
orahotBpar.B+*
"r1"r""r"" * oracle d,a '>+??> Dec 0 3++?
%+;0Bstandards
"r1"r""r"" * oracle d,a ;*>00 Dec > +':*'
lp.onBa/B=lo/
dr1xr"xr"x 3 oracle d,a 3+0>+++ Dec > +':* undoBstats
7 .an ls
7 p1d
&ho.e&oracle
7 cat Geni=txt
3
8/10/2019 08 -Oracle 11g Arch Student
4/83
Gohn:stanl2:,ritto
anton2:Geni:Gas.ine
sa.son:prince:Gohn
ctrlHd
7 cat Geni=txt
Gohn:stanl2:,ritto
anton2:Geni:Gas.ine
sa.son:prince:Gohn
7 .ore Geni=txt
Gohn:stanl2:,ritto
anton2:Geni:Gas.ine
sa.son:prince:Gohn
7 cat Geni=txt
arul:Geevan:vince
ctrl H d
7 .ore Geni=txt
Gohn:stanl2:,ritto
anton2:Geni:Gas.ine
sa.son:prince:Gohn
arul:Geevan:vince
7 vi Geni=txt
Gohn:stanl2:,ritto
anton2:Geni:Gas.ine
sa.son:prince:Gohn
arul:Geevan:vince
7 .ore Geni=txt J /rep Gohn
Gohn:stanl2:,ritto
sa.son:prince:Gohn
7 .ore Geni=txt J /rep e Gohn "e Geni
Gohn:stanl2:,ritto
anton2:Geni:Gas.ine
sa.son:prince:Gohn
4
8/10/2019 08 -Oracle 11g Arch Student
5/83
7 .ore Geni=txt J /rep v Gohn
anton2:Geni:Gas.ine
arul:Geevan:vince
7 .ore Geni=txt
Gohn:stanl2:,ritto
anton2:Geni:Gas.ine
sa.son:prince:Gohn
arul:Geevan:vince
7 1c "l Geni=txt 7 1c 1 Geni=txt 7 1c
"c Geni=txt
0
7 .ore Geni=txt J 1c "l
0
7 head "3 Geni=txt 7 .ore Geni=txt J head "3
Gohn:stanl2:,ritto
anton2:Geni:Gas.ine
7 tail "3 Geni=txt 7.ore Geni=txt J tail "3
sa.son:prince:Gohn
arul:Geevan:vince
7 head "; Geni=txt J tail "3 7 .ore Geni=txt J head "; J tail "3
anton2:Geni:Gas.ine
sa.son:prince:Gohn
7 .ore Geni=txt J cut "d K: "53 7 cut "d : "53 Geni=txt
stanl2
Geni
prince
Geevan
7 .ore Geni=txt J a16 "F: K M print 83
stanl2
Geni
prince
Geevan
7 .ore Geni=txt J a16 "F: K Mprint Na.e : P 83
Na.e : stanl2
5
8/10/2019 08 -Oracle 11g Arch Student
6/83
Na.e : Geni
Na.e : prince
Na.e : Geevan
7 ls "l
dr1BrB B rB B * oracle oinstall 9*3 Nov 3 *:9*
a,c=txt
Br1B rB BrB B * oracle oinstall 0+' Oct *> 3;:+
x2A
dr1BrB B rB B * oracle oinstall 9*3 Nov 3 *:9*
.ail=doc
7 ls "l J a16 K M print 8
a,c=txt
x2A
.ail=doc
7 ls l J /rep Nov J a16 K M print 8
a,c=txt
.ail=doc
7 r. "5r a,c=txt
7 r. "5r &ho.e&oracle& Q
7 r. "5r Q=arc
7 /Aip a,c=txt
7 /Aip &ho.e&oracle& Q
7 /Aip Q= arc
7/unAip Q= /A
7Aip oracle=Aip &ho.e&oracle&Q
7unAip oracle=Aip
7 .v a,c=txt x2A=txt
7 .v &ho.e&oracle& Q &,ac6up&
7 .v r &ho.e&oracle& Q &,ac6up&
7 cd &opt&arch
7 ls l Q= arc J 1c "l
*++++
7 r. "5r Q=arc
8/10/2019 08 -Oracle 11g Arch Student
7/83
r. "5r arch*=arc arch3=arc arch;=arc arch;=arc arch0=arc ==
7 ls "l Q= arc J a16 KM print 8
arch*=arc
arch3=arc
arch;=arc
7 ls "l Q= arc J a16 KM print r. "5r P 8
r. "5r arch*=arc
r. "5r arch3=arc
r. "5r arch;=arc
7 ls "l Q= arc J a16 KM print r. "5r P 8 J sh "x
H r. "5r arch*=arc
H r. "5r arch3=arc
H r. "5r arch;=arc
7 ls "l Q= arc J a16 KM print /Aip P 8 J sh "x
7 ls "l Q= arc J a16 KM print .v P 8 &,ac6up&arch& P J sh "x
7 ls "l Q= arc J /rep %u/ J a16 KM print 8
arch*=arc
arch3=arc
arch;=arc
7 ls "l Q= arc J /rep %u/ J a16 KM print r. "5r P 8 J
sh "x
H r. "5r arch*=arc
H r. "5r arch3=arc
H r. "5r arch;=arc
7 ls "l Q= arc J /rep %u/ J a16 KM print /Aip P 8 J sh "x
7 ls "l J /rep %u/ J a16 KM print .v P 8 &,ac6up&arch& P J sh "x
7 .ore &etc&orata,
OR#I
8/10/2019 08 -Oracle 11g Arch Student
8/83
8/10/2019 08 -Oracle 11g Arch Student
9/83
7 sh &ho.e&oracle&houseB6eep=sh
7 1hich sh
&usr&,in&sh
Cronta, o, schedule
;+ 3+ Q Q Q -nd & "na.e Q=arcP " ati.e H? " exec /AipM
H
;+ 3* Q Q Q -nd & "na.e Q=trcP " ati.e H? " exec
/AipM H
;+ 3+ Q Q Q &usr&,in&sh &ho.e&oracle&houseB6eep=sh
7 cronta, " e
;+ 3+ Q Q Q -nd & "na.e Q=arcP " ati.e H? " exec /AipM
H
;+ 3* Q Q Q -nd & "na.e Q=trcP " ati.e H? " exec
/AipM H
;+ 3+ Q Q Q &usr&,in&sh &ho.e&oracle&houseB6eep=sh
7 cronta, " l
;+ 3+ Q Q Q -nd & "na.e Q=arcP " ati.e H? " exec /AipM
H
;+ 3* Q Q Q -nd & "na.e Q=trcP " ati.e H? " exec
/AipM H
;+ 3+ Q Q Q &usr&,in&sh &ho.e&oracle&houseB6eep=sh
9
* * * * * Command
Weekdays ( 0 - 6 or 1 - 7 )
Months ( 1 12 )
Month date ( 1 31 )
Hours ( 0 23 )
Minutes ( 0 5 )
8/10/2019 08 -Oracle 11g Arch Student
10/83
7 cronta, " r
7 cronta, " l
No cronta, Go, schedule
7 cp a,c=txt x2x=txt
7 cp &ho.e&oracle& Q &,ac6up&
7 cp " r &ho.e&oracle& Q &,ac6up&
7 .6dir "p &opt&oracle&product&*+=3=+&d,B*
7 cd &so5t1are
7 .6dir Dis6* Dis63 Dis6; !atch
7 5ree " .
0+
S1ap '*00 + '*00
7 top
C!U LO%D USER SS IDLE
+ +='; 3*='Y >=;Y ?+=+
* +=9> ;>=;Y 9=0Y 9'=;Y
av/ +='* ;+=+Y '=?Y ';=;Y
$e.or2 : 0'*'93>Z 3;>;930Z used **??>0+Z 5ree
C!U !ID USERN%$E 0 oracle +:3* ;+=?
oracleOR#I
8/10/2019 08 -Oracle 11g Arch Student
11/83
7 6ill " *39>0
7 d5 " h
Files2ste. SiAe Used %vail UseY
$ounted on
&dev&vA5s+* *+ 9=9 0=' 99Y
&
&dev&vA5s+3 *++$ 0$ 9*$ 0Y &,oot
&dev&vA5s+; 3 *=3 >++$ 'Y &t.p
&dev&vA5s+0 3+ 9=9 *0=' 39Y
&opt
&dev&vA5s+9 3++ *3 > 3Y
&,ac6up
7 d5 " .
7 d5 " 6
7 d5
7 cd &,ac6up
7 ls l
dr1xr"xr"x 3 oracle d,a 0+' $a2 ** 3+*+ test
dr1xr"xr"x * oracle d,a 0+' an 3> 3++ prod
7 du " h test
39 test
7 du " . test
7 du " 6 test
7 du test
F
[indo1s:
C:VoracleVora3Varch*=arc \\\\\\\\\\\\\
&opt&oracle&,ac6up=txt
C:V cd oracleVora3
[indo1s
*3=*'>=*=*++
Linux
*3=*'>=*=*+*User: oracle!1d: oracle
11
8/10/2019 08 -Oracle 11g Arch Student
12/83
C:VoracleVora3 5tp *3=*'>=*=*+*
Userna.e :oracle
!ass1ord :oracle
5tp pro.pt
5tp ,in
5tp .put arch*=arc &opt&oracle&
5tp ./et &opt&oracle&,ac6up=txt C:VoracleVora3
5tp ,2e
C:VoracleVora3
&opt&oracle&arch*=arc \\\\\\\\\\\\\\\\\
&,ac6up&arch&arch3=arc
Linux*
7 scp " r &opt&oracle&arch*=arc oracle]*3=*'>=*=*+*:&,ac6up&arch
!ass1ord : oracle
7 scp " r oracle]*3=*'>=*=*+*:&,ac6up&arch&arch3=arc &opt&oracle&
!ass1ord : oracle
Oracle Data,ase *+/ Installation on Red at Enterprise Linux 9
Lo/in %s root user
Set Zernel !ara.eters
7 vi &etc&s2sctl=con5
6ernel=sh.all \ 3+?*93
6ernel=sh..ax \ 3*0?0>;'0>
6ernel=sh..ni \ 0+'
6ernel=se. \ 39+ ;3+++ *++ *3>
5s=-le".ax \ '99;'
net=ipv0=ipBlocalBportBran/e \ *+30 '9+++
net=core=r.e.Bde5ault \ 3'3*00
net=core=r.e.B.ax \ 3'3*00
net=core=1.e.Bde5ault \ 3'3*00
Linux*
*3=*'>=*=*++User : stanl2!1d: stanl2
Linux3
*3=*'>=*=*+*User: oracle!1d: oracle
12
8/10/2019 08 -Oracle 11g Arch Student
13/83
net=core=1.e.B.ax \ 3'3*00
7 s2sctl p
Set Securit2 Li.its
7 vi &etc&securit2&li.its=con5
oracle so5t nproc *';>0
oracle hard nproc *';>0
oracle so5t no-le '99;'
oracle hard no-le '99;'
Set Re.ote %uthentication
7 vi &etc&pa.=d&lo/in
session re^uired pa.Bli.its=so
Disa,le SELINUX
7 vi &etc&selinux&con-/
SELINUX\disa,led
Chec6 Existin/ !ac6a/es
7 rp. "^a setarch"3Q
7 rp. "^a .a6e";Q
7 rp. "^a /li,c"3Q
7 rp. "^a li,aio"+Q
7 rp. "^a co.pat"li,stdcHH";;";Q
7 rp. "^a co.pat"/cc";0";Q
7 rp. "^a co.pat"/cc";0"cHH";Q
7 rp. "^a /cc"0Q
7 rp. "^a li,Xp"*Q
7 rp. "^a open.oti5"3Q
7 rp. "^a co.pat"d,"0Q
7 rp. "^a cppQ
7 rp. "^a ,inutilsQ
Install !ac6a/es
13
8/10/2019 08 -Oracle 11g Arch Student
14/83
Fro. Redat %S9 Dis6 *
7 .ount &dev&cdro. &.nt
7 cd &.nt&Enterprise&Server
7 rp. "Uvh setarch"3Q
7 rp. "Uvh .a6e";Q
7 rp. "Uvh /li,c"3Q
7 rp. "Uvh li,aio"+Q
7 cd &
7 eGect
Fro. Redat %S9 Dis6 3
7 .ount &dev&cdro. &.nt
7 cd &.nt&Enterprise&Server
7 rp. "Uvh co.pat"li,stdcHH";;";Q
7 rp. "Uvh co.pat"/cc";0";Q
7 rp. "Uvh co.pat"/cc";0"cHH";Q
7 rp. "Uvh /cc"0Q
7 rp. "Uvh li,Xp"*Q
7 cd &
7 eGect
Fro. Redat %S9 Dis6 ;
7 .ount &dev&cdro. &.nt
7 cd &.nt&Enterprise&Server
7 rp. "Uvh open.oti5"3Q
7 rp. "Uvh co.pat"d,"0Q
7 cd &
7 eGect
7 /roupadd oinstall
7 useradd oracle "/ oinstall
7 pass1d oracle
7 .6dir "p &opt&oracle&product&*+=3=+&d,B*
7 cho1n "R oracle:oinstall &opt
7 vi &etc&redhat"release
redhat"0
7 .6dir p &so5t1are&Dis6*
14
8/10/2019 08 -Oracle 11g Arch Student
15/83
8/10/2019 08 -Oracle 11g Arch Student
16/83
Screen * : Select Installation $ethod
Screen 3 : Speci52 Inventor2 Director2 and Credentials
Screen ; : Select Installation
8/10/2019 08 -Oracle 11g Arch Student
17/83
Screen *+ : Speci52 Data,ase Stora/e Option
Screen ** : Speci52 #ac6up and Recover2 Options
Screen *3 : Speci52 Data,ase Sche.a !ass1ords
Screen *; : Su..ar2
Screen *0 : Install
Screen *9 : Con-/uration %ssistants
17
8/10/2019 08 -Oracle 11g Arch Student
18/83
Screen *' : Data,ase Con-/uration %ssistant
Screen *? : Data,ase Con-/uration %ssistant !ass1ord $ana/e.ent
Screen *> : Execute Con-/uration Scripts
18
8/10/2019 08 -Oracle 11g Arch Student
19/83
Screen *: End O5 Installation
19
8/10/2019 08 -Oracle 11g Arch Student
20/83
Oracle **/ so5t1are installation on REL 9
Set Zernel !ara.eters
7 vi &etc&s2sctl=con5
5s=aio".ax"nr \ *+0>9?'
5s=-le".ax \ '>*9?00
6ernel=sh.all \ 3+?*93
6ernel=sh..ax \ 9;'>?+*3
6ernel=sh..ni \ 0+'
6ernel=se. \ 39+ ;3+++ *++ *3>
net=ipv0=ipBlocalBportBran/e \ +++ '99++
net=core=r.e.Bde5ault \ 3'3*00
net=core=r.e.B.ax \ 0*0;+0
net=core=1.e.Bde5ault \ 3'3*00
net=core=1.e.B.ax \ *+0>9>'
7 s2sctl "p
Set User Li.its
7 vi &etc&securit2&li.its=con5
oracle so5t nproc 3+0?
oracle hard nproc *';>0
oracle so5t no-le *+30
oracle hard no-le '99;'
7 vi &etc&pa.=d&lo/in
session re^uired pa.Bli.its=so
7 vi &etc&selinux&con-/
SELINUX\disa,led
Install OS !ac6a/es
7 rp. "Uvh ,inutils"3=Q
7 rp. "Uvh co.pat"li,stdcHH";;Q
7 rp. "Uvh co.pat"li,stdcHH";;Q=i;>'=rp.
7 rp. "Uvh el5utils"li,el5Q
20
8/10/2019 08 -Oracle 11g Arch Student
21/83
7 rp. "Uvh /cc"0=Q
7 rp. "Uvh /cc"cHH"0=Q
7 rp. "Uvh /li,c"3=Q
7 rp. "Uvh /li,c"co..on"3=Q
7 rp. "Uvh /li,c"devel"3=Q
7 rp. "Uvh /li,c"headers"3=Q
7 rp. "Uvh 6shQ
7 rp. "Uvh li,aio"+=Q
7 rp. "Uvh li,aio"devel"+=Q
7 rp. "Uvh li,/o.p"0=Q
7 rp. "Uvh li,/cc"0=Q
7 rp. "Uvh li,stdcHH"0=Q
7 rp. "Uvh li,stdcHH"devel"0=Q
7 rp. "Uvh .a6e";=Q
7 rp. "Uvh s2sstat"?=Q
7 rp. "Uvh unixOD#C"3=Q
7 rp. "Uvh unixOD#C"devel"3=Q
7 /roupadd oinstall
7 .6dir "p &u+*&app&oracle&product&**=3=+&d,B*
7 cho1n "R oracle:oinstall &u+*
7 ch.od "R ??9 &u+*
7 su " oracle
8 p1d
&ho.e&oracle
8 vi =,ashBpro-le
export OR%CLEBUN`N%$E\D#**
export OR%CLEB#%SE\&u+*&app&oracle
export OR%CLEBO$E\8OR%CLEB#%SE&product&**=3=+&d,B*
export OR%CLEBSID\D#**W
export !%
8/10/2019 08 -Oracle 11g Arch Student
22/83
export !%'B**/R3Bdata,aseB*o53=Aip
7 unAip linux=x>'B**/R3Bdata,aseB3o53=Aip
7 cho1n "R oracle:oinstall &so5t1are
7 ch.od "R ?99 &so5t1are
7 init '
Lo/in as Oracle user
8 cp &so5t1are&**/Data,ase&Dis6*
8 =&runInstaller
22
8/10/2019 08 -Oracle 11g Arch Student
23/83
*= Con-/ure Securit2 Updates Clic6 NextP
3= Select installation option Choose Create and confgure a databaseP then
clic6 NextP
23
8/10/2019 08 -Oracle 11g Arch Student
24/83
;= S2ste. Class Choose Server ClassP then clic6 NextP
0= Node Selection Choose Single instance database installationP then clic6
NextP
24
8/10/2019 08 -Oracle 11g Arch Student
25/83
9= Select Install
8/10/2019 08 -Oracle 11g Arch Student
26/83
?= Create Inventor2 Clic6 NextP
>= !er5or. !rere^uisite Chec6s Clic6 NextP
26
8/10/2019 08 -Oracle 11g Arch Student
27/83
= Su..ar2 Clic6 NextP
*+= Install !roduct
27
8/10/2019 08 -Oracle 11g Arch Student
28/83
**= Data,ase con-/uration %ssistant clic6 Ok
*3= Execute con-/uration Scripts Clic6 OkP
28
8/10/2019 08 -Oracle 11g Arch Student
29/83
*;= Finish clic6 Close
S`L (Structured `uer2 Lan/ua/e)
DDL " Data De-nition Lan/ua/e
o Create
o %lter
o
8/10/2019 08 -Oracle 11g Arch Student
30/83
o Roll,ac6
o Savepoint
DCL " Data Control Lan/ua/e
o rant
o Revo6e
ENO EN%$E %EEND
ERS%L%R DO
*+* ohn 30 $ *3;09=;+ *3"$a2"*+*+3 Stanl2 ;+ $ *3;03=9+ *'"Nov"+
8/10/2019 08 -Oracle 11g Arch Student
31/83
Ena.e varchar3 (*+)
O N
Ena.e char (*+)
Date:
DO date
DD"$on"
*;"$a2"*+
DD"$on"
*;"$a2"3+*+
8 export OR%CLEBSID\prod
8 s^lplus & as s2sd,a
Connected to an idle instance
S`L startup
Or
8 s^lplus & as s2sd,a
Connected to
S`L select na.e@ openB.ode 5ro. v8data,aseW
S`L select instanceBna.e@ status 5ro. v8instanceW
S`L create ta,le e.p ( eno nu.,er(0)@
ena.e varchar3(*+)@
a/e nu.,er(3)@
/ender char@
salar2 nu.,er(?@3)@
doG date ) W
S`L desc e.pW
Eno nu.,er(0)
Ena.e varchar3(*+)
%/e nu.,er(3)
ender charSalar2 nu.,er(?@3)
31
8/10/2019 08 -Oracle 11g Arch Student
32/83
DoG date
S`L insert into e.p values (*+*@Gohn@ ;+@$@ *3;0=;0@*;"Nov"+)W
S`L insert into e.p values ([email protected]@ba/e@b/ender@bsalar2@bdoG)W
Enter ENO :
Enter EN%$E :
Enter %E :
Enter ENDER :
Enter S%L%R :
Enter DO :
S`L &
Enter ENO :
Enter EN%$E :
Enter %E :
Enter ENDER :
Enter S%L%R :
Enter DO :
S`L insert into e.p values (beno@NULL@ba/e@NULL@bsalar2@NULL)W
Enter ENO :
Enter %E :
Enter S%L%R :
S`L insert into e.p (eno@a/e@salar2) values (beno@ba/e@bsalar2)W
Enter ENO :
Enter %E :
Enter S%L%R :
S`L select Q 5ro. e.pW
ENO EN%$E %E ENDER S%L%R DO
*+* Gohn ;+ $ *3;0=0+ *;"$a2"+
S`L select eno@ sala2 5ro. e.pW
ENO S%L%R
*+* *3;0=0+
S`L select Q 5ro. e.p 1here eno\*+*W
Relational Operators:
@ @ \@ \@ @ \
32
8/10/2019 08 -Oracle 11g Arch Student
33/83
S`L select Q 5ro. e.p 1here sala2 0+++W
S`L select Q 5ro. e.p 1here salar2 \ 0+++W
Lo/ical Operators
%ND
OR
NO+++)W
Other operators:
,et1een
in & not in
li6e & not li6e
is null & is not null
S`L select Q 5ro. e.p 1here salar2 ,et1een 0+++ and >+++W
S`L select Q 5ro. e.p 1here eno in (*+*@*+0@*+')W
S`L select Q 5ro. e.p 1here eno not in (*+*@*+0@*+')W
S`L select Q 5ro. e.p 1here ena.e in (Kohn@#ritto)W
S`L select Q 5ro. e.p 1here ena.e not in (Kohn@#ritto)W
S`L select Q 5ro. e.p 1here ena.e li6e K%YW
S`L select Q 5ro. e.p 1here ena.e li6e KYnW
S`L select Q 5ro. e.p 1here ena.e li6e K%YnW
33
8/10/2019 08 -Oracle 11g Arch Student
34/83
S`L select Q 5ro. e.p 1here ena.e not li6e K%YW
S`L select Q 5ro. e.p 1here ena.e not li6e KYnW
S`L select Q 5ro. e.p 1here ena.e is nullW
S`L select Q 5ro. e.p 1here ena.e is not nullW
S`L select count(Q) 5ro. e.pW
S`L select su.(salar2) 5ro. e.pW
S`L select su.(salar2) 5ro. e.p /roup ,2 /radeW
S`L select su.(salar2) 5ro. e.p 1here /rade \ % /roup ,2 /radeW
S`L select .in(salar2)@ .ax(salar2) 5ro. e.pW
S`L select .in(salar2)@ .ax(salar2) 5ro. e.p /roup ,2 /radeW
S`L select Q 5ro. e.p order ,2 enoW
S`L select Q 5ro. e.p order ,2 eno descW
Data Dictionar2
8/10/2019 08 -Oracle 11g Arch Student
35/83
S`L delete 5ro. e.p 1here eno \ *+*W
S`L delete 5ro. e.p 1here /rade \ %W
%lter:
S`L desc e.pW
Eno char (0)
Ena.e varchar3 (*+)
%/e nu.,er (3)
ender char
Salar2 nu.,er (?@ 3)
DoG date
S`L alter ta,le e.p .odi52 eno nu.,er (0)W
S`L alter ta,le e.p .odi52 ena.e varchar3 (*9)W
S`L alter ta,le e.p add ( phone nu.,er (*+))W
S`L desc e.pW
Eno Nu.,er (0)
Ena.e archar3 (*9)
%/e Nu.,er (3)
ender Char
Salar2 Nu.,er (?@ 3)
DoG Date
!hone Nu.,er (*+)
S`L %L
8/10/2019 08 -Oracle 11g Arch Student
36/83
Co..it @ roll,ac6 and Savepoint:
Exa.ple *:
S`L create ta,le e.p (eno nu.,er)W
S`L insert into e.p values (*+*)W
S`L insert into e.p values (*+3)W
S`L co..itW
S`L select count(Q) 5ro. e.pW
S`L insert into e.p values (*+;)W
S`L insert into e.p values (*+0)W
S`L select count(Q) 5ro. e.pW
S`L roll,ac6W
S`L select count(Q) 5ro. e.pW
Exa.ple 3:
S`L create ta,le e.p (eno nu.,er)W
S`L insert into e.p values (*+*)W
S`L insert into e.p values (*+3)W
S`L create ta,le dept (dno nu.,er)W
S`L insert into dept values (*+;)W
S`L insert into dept values (*+0)W
S`L select count(Q) 5ro. e.pW
S`L select count(Q) 5ro. deptW
S`L roll,ac6W
S`L select count(Q) 5ro. e.pW
S`L select count(Q) 5ro. deptW
Exa.ple ;:
S`L create ta,le e.p (eno nu.,er)W
S`L insert into e.p values (*+*)W
S`L insert into e.p values (*+3)W
S`L create ta,le dept (dno nu.,er)W
S`L insert into dept values (*+;)W
S`L insert into dept values (*+0)W
S`L savepoint a*W
S`L select count(Q) 5ro. e.pW
36
8/10/2019 08 -Oracle 11g Arch Student
37/83
S`L select count(Q) 5ro. deptW
S`L delete 5ro. e.pW
S`L delete 5ro. deptW
S`L roll,ac6 to a*W
S`L select count(Q) 5ro. e.pW
S`L select count(Q) 5ro. deptW
S`L co..itW
User $ana/e.ent
$ethod *:
S`L create user stanl2 identi-ed ,2 stanl2*3;W
S`L /rant create session@ create ta,le to stanl2W
S`L conn stanl2&stanl2*3;
S`L sho1 userW
S`L create ta,le e.p(eno nu.,er)W
$ethod 3:
S`L conn s2s&s2s as s2sd,a
S`L create user stanl2 identi-ed ,2 stanl2*3;
de5ault ta,lespace data
te.porar2 ta,lespace te.pW
S`L conn stanl2&stanl2*3;
S`L create ta,le dept (dno nu.,er)W
S`L create ta,le a,c (eno nu.,er) ta,lespace testt,sW
$ethod ;:
S`L conn s2s&s2s as s2sd,a
S`L create user stanl2 identi-ed ,2 stanl2*3;
de5ault ta,lespace data
te.porar2 ta,lespace te.p
^uota *+$ on testt,s
^uota unli.ited on tools
pass1ord expireW
S`L conn stanl2&stanl2*3;
Ne1 !ass1ord :
Ret2pe !ass1ord :
S`L sho1 userW
37
8/10/2019 08 -Oracle 11g Arch Student
38/83
S`L create ta,le a,c (eno nu.,er) ta,lespace testt,sW
S`L create ta,le x2A (eno nu.,er) ta,lespace toolsW
S`L conn s2s&s2s as s2sd,a
S`L alter user stanl2 de5ault ta,lespace dataW
S`L alter user stanl2 te.porar2 ta,lespace te.pW
S`L select Q 5ro. d,aBtsB^uotasW
Userna.e ta,lespaceBna.e .ax,2tes usedB,2tes
Stanl2 testt,s *+ $ $
Stanl2 tools "* 3+$
S`L alter user stanl2 ^uota 9+$ on testt,sW
S`L alter user stanl2 ^uota +$ on toolsW
S`L select Q 5ro. d,aBusersW
Userna.e DBta,lespace
8/10/2019 08 -Oracle 11g Arch Student
39/83
Connected=
S`L CONN test3&test3
OR%"+*+*?: invalid userna.e&pass1ordW lo/on denied
S`L CONN & %S SSD#%
S`L %L
8/10/2019 08 -Oracle 11g Arch Student
40/83
S`L /rant select on e.p to Gohn 1ith /rant optionW
S`L conn Gohn&Gohn
S`L select Q 5ro. e.pW
S`L select Q 5ro. stanl2=e.pW
S`L /rant select on stanl2=e.p to GeniW
S`L select Q 5ro. userBta,BprivsW
S`L conn stanl2&stanl2
S`L revo6e select on e.p 5ro. GohnW
S`L select Q 5ro. userBta,BprivsW
S`L conn s2s&s2s as s2sd,a
S`L select Q 5ro. d,aBta,BprivsW
Roles:
D#%
Connect
resource
I.pB5ullBdata,ase
ExpB5ullBdata,ase
SelectBan2Bcatalo/
Reover2Bcatalo/Bo1ner
S`L create role uroleW
S`L /rant create session@ create ta,le@ select on stanl2=e.p to uroleW
S`L /rant urole to GohnW
S`L /rant urole to pu,licW
S`L revo6e select on stanl2=e.p 5ro. uroleW
S2ste.!rivile/e
s
O,Gect!rivile/e
s
RoleNa.e
User
40
8/10/2019 08 -Oracle 11g Arch Student
41/83
S`L drop role urole cascadeW
S`L select Q 5ro. d,aBrolesW
S`L select Q 5ro. d,aBroleBprivsW
S`L conn stanl2&stanl2
S`L select Q 5ro. userBroleBprivsW
!ro-les:
F%ILEDBLOINB%
8/10/2019 08 -Oracle 11g Arch Student
42/83
S`L drop pro-le upro5 cascadeW
S`L select Q 5ro. d,aBpro-lesW
Constraints:
Not null
Uni^ue 6e2
!ri.ar2 6e2
Forei/n 6e2
Chec6
S`L create ta,le e.p ( eno nu.,er not null@ Ena.e varchar3 (*+))W
S`L create ta,le e.p ( eno nu.,er constraint nn not null@
Ena.e varchar3 (*+))WS`L create ta,le e.p (eno nu.,er@ ena.e varchar3 (*+))W
S`L alter ta,le e.p .odi52 eno not nullW
S`L %L
8/10/2019 08 -Oracle 11g Arch Student
43/83
S`L create ta,le dept ( dno nu.,er constraint p6BdnoBdept pri.ar2 6e2@
Dna.e varchar3(*+) constraint nn not null)W
S`L create ta,le e.p ( eno nu.,er constraint p6*Beno pri.ar2 6e2@
Ena.e varchar3(*+)@
Dno nu.,er)W
S`L alter ta,le e.p add constraint 56BdnoBe.p 5orei/n 6e2 (dno)
re5erences dept (dno)W
DEFERR%#LE and DEFERRED Constraints:
S`L %L
8/10/2019 08 -Oracle 11g Arch Student
44/83
%E*>
S`L select Q 5ro. userBconsBcolu.nsW
INDEXES
#tree index
#it.ap index Function ,ased index
Reverse 6e2 index
S`L create index indBeno on e.p( eno)W
S`L create index indBenoBphone on e.p(eno@phone)W
S`L create ,it.ap index indB/ender on e.p(/ender)W
S`L create ,it.ap index indBsalBdno on e.p(salar2@dno)W
S`L create index indBena.e on e.p(U!!ER(ena.e))WS`L create index indBco.. on e.p(salar2 Q +=*+)W
S`L create index indBenoBrev on e.p(eno) reverseW
S`L alter index indBeno .onitorin/ usa/eW
S`L select Q 5ro. v8o,GectBusa/eW
S`L alter index indBeno no.onitorin/ usa/eW
S`L select Q 5ro. d,aBindexesW
S`L select Q 5ro. d,aBindBcolu.nsWS`L conn stanl2&stanl2
S`L select Q 5ro. userBindexesW
S`L select Q 5ro. userBindBcolu.nsW
Oracle oins:
*= Inner oins:
!OR<
8/10/2019 08 -Oracle 11g Arch Student
45/83
S`L SELEC< SI!BID@ SI!BN%$E@ !OR
8/10/2019 08 -Oracle 11g Arch Student
46/83
SI!BID SI!BN%$E !OR
8/10/2019 08 -Oracle 11g Arch Student
47/83
S`L sho1 s/aW
>> ,2tes
aria,le SiAe 0030+>> ,2tes
Data,ase #uers *';>0+++ ,2tes
Redo #uers *+'0'+ ,2tes
S`L sho1 para.eter s/aB.axBsiAeW
N%$E
8/10/2019 08 -Oracle 11g Arch Student
48/83
S`L alter s2ste. set s/aB.axBsiAe\9'. scope\sp-leW
S`L sho1 para.eter s/aB.axBsiAeW
N%$E ?93 ,2tes
Redo #uers 0>++9*3 ,2tes
Data,ase .ounted=
Data,ase opened=
S`L sho1 para.eter s/aB.axBsiAe
N%$E
8/10/2019 08 -Oracle 11g Arch Student
49/83
S`L sho1 para.eter d,BcacheBsiAeW
S`L sho1 para.eter d,B6eepBcacheBsiAeW
S`L sho1 para.eter d,Brec2cleBcacheBsiAeW
S`L alter s2ste. set d,BcacheBsiAe \"""""""""""$W
S`L alter s2ste. set d,B6eepBcacheBsiAe \""""""""""""$W
S`L alter s2ste. set d,B6eepBcacheBsiAe \ """""""""""""$W
Data,ase ,uer cache sta/es:
!inned #uer
Dirt2 #uer
Free #uer
Redo Lo/ #uer:
S`L sho1 para.eter lo/B,uer W
S`L alter s2ste. set lo/B,uer \ *+0>9?'+ scope\sp-leW
*+$#
Lar/e !ool :
49
Database
Buffer
Cache
Redo
o!
BufferRedo Data
R-
Startn!
"ont
R-
.ndn!
"ont
"nned Buffer
Drt
Buffer
ar!e "oo#
-GA
Shared "oo#
brar
CacheData
Dctonar
Cache
-GA
!" #ar$e %oo# is &on"i$ured then
' stored in
#se
' stored in
8/10/2019 08 -Oracle 11g Arch Student
50/83
S`L sho1 para.eter lar/eBpoolBsiAeW
S`L alter s2ste. set lar/eBpoolBsiAe \ """""""""""""$W
ava !ool:
S`L sho1 para.eter GavaBpoolBsiAeW
S`L alter s2ste. set GavaBpoolBsiAe \ """"""""""$ scope\sp-leW
Strea.s !ool:
S`L sho1 para.eter strea.sBpoolBsiAeW
S`L sho1 para.eter strea.sBpoolBsiAe \ """""""""""$ scope\sp-leW
#ac6/round !rocesses:
S$ON
D#[R
L[R
CZ!6@ *'6@ ;36
8/10/2019 08 -Oracle 11g Arch Student
54/83
S`L create ta,le test (no nu.,er) ta,lespace datat,s initrans *+ .axtrans 399
pctused > pct5ree *+W
Ro1id For.at :
S`L SELEC< RO[ID FRO$ e.plo2ees [ERE e.plo2eeBid \ *++W
RO[ID
%%%!ec%%F%%%%#S%%%
#loc6 level pro,le.s
Ro1 Chainin/
Ro1 $i/ration
i/h [ater $ar6 ([$)
Oracle Extents:
>Z >Z >Z >Z
>Z >Z >Z >Z
De5ault stora/e para.eters
initial
next
.inextents
.axextens
pctincrease
8/10/2019 08 -Oracle 11g Arch Student
55/83
S`L CRE%
8/10/2019 08 -Oracle 11g Arch Student
56/83
S`L insert into 5Bre/s values(*@T#RDS
8/10/2019 08 -Oracle 11g Arch Student
57/83
8/10/2019 08 -Oracle 11g Arch Student
58/83
S`L select ta,lespaceBna.e@ ,loc6BsiAe@ ExtentB.ana/e.ent@ #i/-le 5ro.
d,aBta,lespacesW
S.all-le ta,lespace:
S`L CRE%
8/10/2019 08 -Oracle 11g Arch Student
59/83
S`L %L
8/10/2019 08 -Oracle 11g Arch Student
60/83
S`L alter ta,lespace data rena.e data-le
K&opt&oradata&data+*=d,5 to K&u+*&oradata&data+*=d,5 W
S`L alter ta,lespace datat,s onlineW
S`L select -leBna.e 5ro. d,aBdataB-les 1here ta,lespaceBna.e\ D%
8/10/2019 08 -Oracle 11g Arch Student
61/83
onlineW
S`L SELEC< occupantBna.e@ .oveBprocedure@ spaceBusa/eB6,2tes FRO$
v8s2sauxBoccupantsW
OCCU!%N *>+330 DIS%#LED
S`L create ta,lespace USERBD%61
8/10/2019 08 -Oracle 11g Arch Student
62/83
data-le T&u+*&oracle&oradata&DE
8/10/2019 08 -Oracle 11g Arch Student
63/83
CO$!RESS FOR DIREC
8/10/2019 08 -Oracle 11g Arch Student
64/83
DEF%UL< CO$!RESS FOR %LL O!ER%
8/10/2019 08 -Oracle 11g Arch Student
65/83
S`L insert into
8/10/2019 08 -Oracle 11g Arch Student
66/83
S`L alter data,ase de5ault te.porar2 ta,lespace te.p*W
S`L select propert2Bvalue 5ro. data,aseBproperties
1here propert2Bna.e\ DEF%UL)&*+30
5ro. v8sortBse/.entW
S`L select userna.e@ta,lespace@,loc6s 5ro. v8sortBusa/e 1here
contents\
8/10/2019 08 -Oracle 11g Arch Student
67/83
9?'
0*0;+0+
S`L %L
8/10/2019 08 -Oracle 11g Arch Student
68/83
undoB.ana/e.ent \ M auto J .anual
S`L sho1 para.eter undoBretentionW
S`L sho1 para.eter undoBta,lespaceW
S`L sho1 para.eter undoB.ana/e.entW
S`L create undo ta,lespace undot,s3 Data-le K&opt&oradata&undo+3=d,5 siAe
*++$W
S`L alter s2ste. set undoBta,lespace\undot,s3 scope\sp-leW
UNDOBRE
8/10/2019 08 -Oracle 11g Arch Student
69/83
Oracle $ana/ed Files:
D#BCRE%
8/10/2019 08 -Oracle 11g Arch Student
70/83
colu.nBna.e fdatat2peg fENER%
8/10/2019 08 -Oracle 11g Arch Student
71/83
COLU$NBN%$E D%
8/10/2019 08 -Oracle 11g Arch Student
72/83
S`L alter s2ste. set d,B*'ZBcacheBsiAe\*'Z scope\sp-leW
S`L shutdo1n i..ediateW
S`L startup
S`L create p-le 5ro. sp-leW
S`L create p-le\&u+*&oradata&initprod=ora 5ro. sp-leW
S`L create p-le 5ro. .e.or2W
S`L create sp-le 5ro. .e.or2W
!ara.eter lists:
8 vi 8OR%CLEBO$E&d,s&initprod=ora
d,Buni^ueBna.e \ prodd,Bna.e \ prod
d,B,loc6BsiAe \ >*3
d,B1riterBprocesses \ >
controlB-les \ T&u+*&oradata&control=ctlT
resourceBli.it \ true
nlsBdateB5or.at \ DD"$ON"
lo/BarchiveBdest \ &u+*&oradata&archlo/BarchiveB.axBprocesses \ 0
auditB-leBdest \ &u+*&ad.in&prod&adu.p
,ac6/roundBdu.pBdest \ &u+*&ad.in&prod&,du.p
coreBdu.pBdest \ &u+*&ad.in&prod&cdu.p
userBdu.pBdest \ &u+*&ad.in&prod&udu.p
d,B-les \ 9*3
s/aB.axBsiAe \ >++$s/aBtar/et\'++$
d,BcacheBsiAe \ *++$
sharedBpoolBsiAe \ *9+$
lo/B,uer \ 0*0;+0
GavaBpoolBsiAe \ *9+$
lar/eBpoolBsiAe \ 9++$
p/aBa//re/ateBtar/et \ *+30$
strea.sBpoolBsiAe \ *+$
72
8/10/2019 08 -Oracle 11g Arch Student
73/83
undoBretention \ 3>+++
undoB.ana/e.ent \ TautoT
undoBta,lespace \ Tundot,s*T
co.pati,le \ **=3=+=+=+
Startup Options:
Startup no.ount
Startup .ount
Startup nor.al
Startup 5orce
Startup restrict
Startup .i/rate
Startup up/rade
o %L
8/10/2019 08 -Oracle 11g Arch Student
74/83
S`L %L
8/10/2019 08 -Oracle 11g Arch Student
75/83
S`L alter s2ste. set controlB-les\ K&opt&oradata&control+*=ctl @
K&opt&oradata&control+3=ctl
scope\sp-l
eW
S`L SELEC< N%$E FRO$ 8CON
8/10/2019 08 -Oracle 11g Arch Student
76/83
S`L shutdo1n i..ediateW
S`L startupW
Control-le ro1thin/ !ara.eter:
$%XLOFILES
$%XLO$E$#ERS
$%XLOIS
8/10/2019 08 -Oracle 11g Arch Student
77/83
* *+0>9?' * ES %C9?' * NO CURREN9?' * ES IN%C
8/10/2019 08 -Oracle 11g Arch Student
78/83
S`L SELEC< LOB$ODE FRO$ 8D%
8/10/2019 08 -Oracle 11g Arch Student
79/83
%rchive destination : &opt&oradata&arch
Oldest online lo/ se^uence : *3
Next lo/ se^uence to archive : *;
Current lo/ se^uence : *;
S`L sho1 para.eter lo/BarchiveBdestW
S`L alter s2ste. set lo/BarchiveBdest\&u+*&oracle&arch W
S`L alter s2ste. set LOB%RCIEBDU!LEXBDES< \ T&dis63&archiveT
Lo/BarchiveBdestB* \
:
Lo/BarchiveBdestB*+ \
S`L alter s2ste. set lo/BarchiveBdestB*\LOC%
8/10/2019 08 -Oracle 11g Arch Student
80/83
$anual Data,ase Creation:
8 .6dir 8OR%CLEB#%SE&ad.in&prod
8 cd 8OR%CLEB#%SE&ad.in&prod
8 .6dir p-le ,du.p udu.p cdu.p adu.p create
8 .6dir 8OR%CLEB#%SE&oradata&prod
8 export OR%CLEBSID\prod
8 orap1d -le\8OR%CLEBO$E&d,s&orap1prod pass1ord\s2s
8 s^lplus & as s2sd,a
S`L startup p-le\8OR%CLEB#%SE&ad.in&prod&p-le&initprod=ora no.ount
S`L create data,ase prod
Data-le K&opt&oracle&oradata&prod&s2ste.+*=d,5 siAe 9++$
S2saux data-le K&opt&oracle&oradata&prod&s2saux+*=d,5 siAe 9++$
Lo/-le K&opt&oracle&oradata&prod&redo*=lo/ siAe 9+$ @
K&opt&oracle&oradata&prod&redo*=lo/ siAe 9+$
Undo ta,lespace undot,s*
Data-le K&opt&oracle&oradata&prod&undo+*=d,5 siAe *++$
+C,( 4o%t4orae )
admin
oradata
%"i#e dum% udum% &dum% adum% &reate
%rod %rod
80
8/10/2019 08 -Oracle 11g Arch Student
81/83
De5ault te.porar2 ta,lespace te.p
8/10/2019 08 -Oracle 11g Arch Student
82/83
Data,aseCredentials
Stora/e Options
Data,ase FileLocation
Recover2Con-/uration
Data,aseContent
Installation!ara.eters
Data,aseStora/e
Creation Option
Con-/uration
82
8/10/2019 08 -Oracle 11g Arch Student
83/83