Author
da-lanh
View
27
Download
0
Embed Size (px)
DESCRIPTION
Thực hành oracle
L Vn Lng
1
Cu 1: To database c tn l dbdemo, character set l AL32UTF8
- S dng dbca to database.
Chn Next
- Chn ty chn: Create a Database.
L Vn Lng
2
- Nhn Next tip tc.
- Chn ty chn: General Purpose or Transaction Processing. - Nhn Next tip tc.
L Vn Lng
3
- t tn database l: dbdemo - t tn SID l: dbdemo - Nhn Next tip tc
- Check chn Configure Enterprise Manager .
L Vn Lng
4
- Chn Next tip tc.
- Chn Next tip tc
- G password ca ASM
L Vn Lng
5
- Chn Storage Type: ASM (Automatic Storage Management) - Tn diskgroup: +DATA - Chn Next tip tc
- Chn Next tip tc.
L Vn Lng
6
- Chn Next tip tc
L Vn Lng
7
L Vn Lng
8
- Chn Next tip tc
L Vn Lng
9
- Chn Next tip tc
- Click Finish
- Chn OK
L Vn Lng
10
Cu 2: Multiplex control file thnh 4 controlfile
L Vn Lng
11
/u01/app/oracle/oradata/dbdemo/control01.ctl /u01/app/oracle/oradata/dbdemo/control02.ctl /u01/app/oracle/oradata/dbdemo/control03.ctl /u01/app/oracle/oradata/dbdemo/control04.ctl
- Login vo user Oracle to th mc dbdemo theo ng dn: /u01/app/oracle/oradata/dbdemo cha multiplex control file
- S dng . oraenv st bin mi trng ORACLE_SID = dbdemo
- ng nhp vo sqlplus vi quyn sysdba
- Kim tra control_file gc u
- Dng ASMCMD copy controlfile ra th mc /u01/app/oracle/oradata/dbdemo
L Vn Lng
12
- Set li controlfile to multiplex
- Dng RMAN restore controlfile t controlfile ang dng
L Vn Lng
13
Cu 3: Multiplex redolog Group 1: /u01/app/oracle/oradata/dbdemo/redo01.log /u01/app/oracle/oradata/dbdemo/redo01b.log Group 2: /u01/app/oracle/oradata/dbdemo/redo02.log
L Vn Lng
14
/u01/app/oracle/oradata/dbdemo/redo02b.log Group 3: /u01/app/oracle/oradata/dbdemo/redo03.log /u01/app/oracle/oradata/dbdemo/redo03b.log
- Kt ni ti sqlplus:
- To
L Vn Lng
15
Cau 4: Chuyn DB sang ARCHIVELOG mode /u01/app/archive
- To th mc archive
- Vo sqlplus kim tra trng thi ARCHIVELOG
- Ta thy trng thi ang l No Archive Mode - Thc hin chuyn trng thi v Archive Mode
L Vn Lng
16
- Kim tra li trng thi
Cu 5: To tablespace DATA: /u01/app/oracle/oradata/dbdemo/data01.dbf Size: 5M Autoextend on
L Vn Lng
17
Cu 6: To user TEST , default tablespace l DATA
L Vn Lng
18
Cu 7: Dng user TEST to table TEST(id number); - Ti user sys:
- ng nhp vo user test to table test(id number)
L Vn Lng
19
Cu 8: Backup full database vo /u01/app/rman - To th mc rman
- Thc hin backup ( trng thi Archivelog)
- File backup trong th mc /u01/app/rman
L Vn Lng
20
Cu 9: Xa file /u01/app/oracle/oradata/dbdemo/user01.dbf /u01/app/oracle/oradata/dbdemo/system01.dbf
- Shutdown immediate trong RMAN
- Di chuyn n th mc datafile
cd u01/app/oracle/oradata/DBDEMO/datafile
- Thc hin xa file
Rm o1_mf_user*
Rm o1_mf_syst*
Cu 10: Phc hi cc file b mt, c th open c database
- Trong RMAN
RMAN>startup
L Vn Lng
21
RMAN>Restore datafile 1;
RMAN>Recover datafile 1;
RMAN > sql alter database datafile 4 offline
RMAN>alter database open
RMAN>restore datafile 4;
RMAN>recover datafile 4;
RMAN > sql alter database datafile 4 online
Cu 11: To spfile v pfile
Cu 12: To thm 1 Listener :
a. Tn: LISTENER1 b. Port 1527 c. Protocol: TCP d. Cu hnh listener ng k tnh
L Vn Lng
22
- S dng NETMGRcu hnh
L Vn Lng
23
L Vn Lng
24
- Lu cu hnh li
L Vn Lng
25
Cu 13: Dng netca cu hnh file tnsnames.ora cho php kt ni vi database dbdemo
L Vn Lng
26
L Vn Lng
27
L Vn Lng
28
- Kt qu trong file tnsnames.ora
L Vn Lng
29
Cu 14: Insert d liu vo table test v commit. Sau xa ht controlfile. Phc hi CSDL m bo cc dng trong table test cn y .
- Insert d liu vo table test v commit
- Backup li controlfile
- Xa tt c cc control file:
L Vn Lng
30
- Phc hi li controlfile