SlideShare a Scribd company logo
1 of 31
Download to read offline
HỌC VIỆN NGÂN HÀNG
KHOA LÝ HỆ THỐNG THÔNG TIN QUẢN LÝ
BÀI TẬP LỚN:
MÔN CƠ SỞ DỮ LIỆU 2
ĐỀ TÀI: HỆ THỐNG QUẢN LÝ
LIVE STREAMING
Giảng viên hướng dẫn: Nguyễn Thị Thu Trang
Nhóm viên thực hiện: 13
Nhóm tín chỉ: 202IS12A01
Hà Nội, ngày 20 tháng 06 năm 2021
Danh sách thành viên nhóm
STT Họ và tên Mã sinh viên Lớp niên chế % đóng góp
1 Bùi Thu Hà 22A4040011 K22HTTTA 25%
2 Nguyễn Thị Lan Anh 22A4040099 K22HTTTB 25%
3 Nguyễn Quang Huy 22A4040018 K22HTTTA 25%
4 Chu Thúy Quỳnh 22A4040087 K22HTTTB 25%
Mục lục
I. Mô tả bài toán ..........................................................................................1
1. Phát biểu bài toán..................................................................................1
2. Mục đích bài toán .................................................................................1
3. Sơ đồ thực thể liên kết ..........................................................................2
II. Triển khai bài toán ...................................................................................4
1. Tạo cơ sở dữ liệu ..................................................................................4
1.1. Tablespace............................................................................................................. 4
1.2. Tạo bảng................................................................................................................. 5
1.3. Nhập dữ liệu ......................................................................................................... 7
1.4. Phân vùng dữ liệu............................................................................................. 12
2. Thực hiện yêu cầu truy vấn.................................................................12
3. Thực hiện yêu cầu nghiệp vụ..............................................................15
4. Thực hiện quản trị cơ sở dữ liệu.........................................................21
4.1. Tạo user................................................................................................................ 21
4.2. Sao lưu (backup)............................................................................................... 22
4.3. Phục hồi (recovery) ......................................................................................... 26
III. Kết luận...............................................................................................28
1. Ưu điểm ..............................................................................................28
2. Nhược điểm.........................................................................................28
1
I. Mô tả bài toán
1. Phát biểu bài toán
Để có thể phát trực tiếp buổi chơi game hoặc nói chuyện, giao lưu với
người xem thì streamer sẽ phải sử dụng các nền tảng livestream. Mỗi nền tảng sẽ
có những ưu điểm và nhược điểm riêng, việc sử dụng nền tảng nào là do nhu
cầu, ý muốn của từng người. Các nền tảng sẽ xây dựng website riêng và app trên
điện thoại để tiện lợi hơn cho người dùng cũng như người xem livestream. Ở
mỗi nền tảng, người dùng có thể đặt các tên tài khoản khác nhau với số lượng
subcriber khác nhau. Để thu hút và tạo môi trường phát triển tốt hơn cho các
streamer, mỗi nền tảng sẽ lựa chọn hợp tác với một số nhà phát hành game để có
những ưu đãi bằng cách đảm bảo thực hiện các điều kiện của nhà phát hành
game đưa ra. Nhà phát hành game có mã, tên và địa chỉ web riêng. Mỗi game do
một nhà phát hành game phát hành độc quyền. Game có mã riêng, có tên, thể
loại, dung lượng game và link tải. Mỗi streamer có thể chơi nhiều game và mỗi
game cũng được nhiều streamer chơi.
Donater sẽ đăng kí tài khoản và nạp tiền vào một cổng donate nhất định.
Mỗi cổng donate đều có website và có tỉ lệ chiết khấu (từ số tiền donater ủng hộ)
khác nhau. Donater có thể nhập số tiền và lời nhắn khi ủng hộ tiền cho streamer
thông qua cổng donate.
2. Mục đích bài toán
Khái niệm livestream được dịch ra tiếng Việt là truyền video trực tiếp.
Trong đó, live là trực tiếp, còn stream là một trong những phương pháp giúp
truyền tải các dữ liệu khi người xem video thông qua mạng internet. Livestream
lần đầu tiên được sử dụng với tên gọi upstream vào năm 2007 dành cho binh
lính Mỹ và dần phát triển mạnh mẽ trên nhiều lĩnh vực. Đặc biệt, năm 2020 đã
đánh dấu mốc phát triển mới cho ngành công nghiệp game livestreaming. Dịch
Covid-19 xuất hiện từ những tháng đầu tiên của năm 2020 và gây nên những
ảnh hưởng đến toàn xã hội. Theo số liệu từ Statista (Cổng thông tin trực tuyến
về thống kê của Đức), 49% người tham gia khảo sát dành nhiều thời gian trên
2
internet hơn, 36% người chơi game nhiều hơn, 69% người dùng tăng thời gian
sáng tạo và theo dõi các nội dung streaming tại nhà. Ngoài những streamer kì
cựu, năm 2020 và nửa đầu năm 2021 còn đón chào nhiều người nổi tiếng trên
các lĩnh vực khác tham gia “ngành công nghiệp tỷ đô” này: ca sĩ Khởi My,
rapper MCK, thủ môn Bùi Tấn Trường, bình luận viên Lê Khôi,…
Trước ảnh hưởng kéo dài của dịch Covid-19, hầu hết các hoạt động kinh
doanh đều được chuyển sang hình thức trực tuyến, đây cũng là lúc truyền thông
- marketing online càng được chú trọng và yêu cầu tính hiệu quả cao. Một trong
những nội dung giải trí trực tuyến thu hút được nhiều sự theo dõi của người
dùng internet trong thời điểm cách ly là các nội dung gaming livestream. Điều
đó đã đưa “nghề streamer” trở nên hot và phát triển nhanh hơn bao giờ hết. Chỉ
một buổi livestream khoảng 4-5 tiếng có thể đem đến cho streamer số tiền lên
tới hàng chục triệu đồng cùng với sự chú ý của nhiều nhãn hàng và có thể là
những hợp đồng quảng cáo giá trị cao. Tiềm năng kinh tế lớn như vậy đòi hỏi
“gaming creators” cần có ekip trợ giúp sắp xếp, sáng tạo, phát triển thêm nhiều
nội dung nhằm thu hút nhiều nhất số lượng người xem, đem đến lợi ích kinh tế
cho bản thân, tổ chức thậm chí là cho xã hội. Đó là công việc của công ty quản
lý. Công ty quản lý sẽ gồm “gaming creators” - được coi như những “ngôi sao”,
cùng với đội ngũ sáng tạo nội dung, sắp xếp lịch trình, quản lý thu nhập, phát
triển cộng đồng, liên hệ đối tác,… Cơ sở dữ liệu này sẽ góp phần giúp công việc
đó trở nên đơn giản hơn.
3. Sơ đồ thực thể liên kết
3
4
II. Triển khai bài toán
1. Tạo cơ sở dữ liệu
1.1. Tablespace
a. Mục đích
Quản lý tablespace trong Oracle đặc biệt quan trọng trong việc cấp vùng dữ
liệu làm việc cho user. Với mỗi tablespace ta có thể tùy chỉnh chế độ online
hoặc offline để thay đổi tính sẵn dùng của các dữ liệu trong database vì mỗi dữ
liệu lại gắn với những yêu cầu, mục đích sử dụng, quản lí khác nhau. Hơn thế
nữa, việc tạo thêm tablespace giúp ích rất lớn cho việc sao lưu (backup) và phục
hồi (recovery) dữ liệu một cách hiệu quả nhất, năng suất cao nhất. Bởi
tablespace có một điểm rất hữu ích đó là ta có thể chuyển các tablespace sang
chế độ read-only (chỉ đọc) để hạn chế các thủ tục cần thiết khi sao lưu và phục
hồi một phần lớn dữ liệu không bị thay đổi của database. Vì Oracle sẽ không
thực hiện cập nhật các file nằm trong tablespace read-only.
Từ các bảng được sử dụng trong đề tài và mục đích sử dụng mỗi bảng, ta
chỉ cần tạo 2 tablespace là myspace1 và myspace2. Với tablespace myspace1 ta
lưu trữ các dữ liệu ít bị thay đổi còn tablespace myspace2 ta lưu trữ các dữ liệu
thường xuyên phải cập nhật, thay đổi như: subcriber, thời điểm chơi, thời điểm
donate, số tiền donate, lời nhắn, số dư tài khoản,… Việc phân chia này được
phục vụ cho việc nâng cao hiệu suất trong việc sao lưu và phục hồi dữ liệu theo
từng phần.
b. Tạo tablespac
CREATE TABLESPACE myspace1
DATAFILE 'G:appFPTSHOPoradataorclTablespace01.dbf' SIZE
100M
autoextend on
next 100m maxsize 1024m
extent management local;
5
1.2.Tạo bảng
CREATE TABLE Streamer
(
MASTREAMER NVARCHAR2(10)PRIMARY KEY NOT NULL,
check (REGEXP_LIKE(MASTREAMER,'^STd{2,}$')),
TENSTREAMER NVARCHAR2(50),
GIOITINH NVARCHAR2(10),
QUEQUAN NVARCHAR2(50),
NGAYSINH DATE,
SODIENTHOAI NVARCHAR2(12) CHECK
(REGEXP_LIKE(SODIENTHOAI, '^0d{9}$|^0d{10}$')) );
CREATE TABLE NhaPhatHanhGame
(
MANHAPHATHANH NVARCHAR2(10)PRIMARY KEY NOT NULL,
TENNHAPHATHANH NVARCHAR2(50),
DIACHIWEB NVARCHAR2(50));
CREATE TABLE NenTang
(
WEBSITE NVARCHAR2(50) PRIMARY KEY NOT NULL,
TENNENTANG NVARCHAR2(50),
MOBILEAPP NVARCHAR2(50));
CREATE TABLE CongDonate
(
WEBCONG NVARCHAR2(50) primary key NOT NULL,
TENCONG NVARCHAR2(50),
TILECHIETKHAU FLOAT,
check(tilechietkhau >=0));
CREATE TABLE Donater
(
MADONATER NVARCHAR2(10) PRIMARY KEY NOT NULL
check (REGEXP_LIKE(MADONATER,'^DTd{2,}$')),
WEBCONG NVARCHAR2 (50),
TENTAIKHOAN NVARCHAR2(50),
SODUTAIKHOAN number,
Constraint fk_webcong foreign key (webcong) references
Congdonate
);
CREATE TABLESPACE myspace2
DATAFILE 'G:appFPTSHOPoradataorclTablespace02.dbf' SIZE
500M
autoextend on
next 500m maxsize 4028m
extent management local;
6
CREATE TABLE Game
(
MAGAME NVARCHAR2(10) PRIMARY KEY NOT NULL
check (REGEXP_LIKE(MAGAME,'^Gd{2,}$')),
MANHAPHATHANH NVARCHAR2(10) NOT NULL,
TENGAME NVARCHAR2(50) NOT NULL,
THELOAI NVARCHAR2(50) NOT NULL,
LINKDOWNLOAD NVARCHAR2(100),
DUNGLUONG NVARCHAR2(10),
Constraint fk_manhaphathanh foreign key (manhaphathanh)
references Nhaphathanhgame
);
CREATE TABLE CHOI
(
MASTREAMER NVARCHAR2(10) NOT NULL,
MAGAME NVARCHAR2(10) NOT NULL,
THOIDIEMBATDAU DATE,
THOIDIEMKETTHUC DATE,
check (THOIDIEMBATDAU < THOIDIEMKETTHUC),
Constraint pk_Streamer_Game primary key (mastreamer,
magame),
Constraint fk_mastreamer_magame foreign key ( mastreamer)
references Streamer,
Constraint fk_magame_mastreamer foreign key (magame)
references Game
);
CREATE TABLE HOPTAC
(
WEBSITE NVARCHAR2(50) NOT NULL,
MANHAPHATHANH NVARCHAR2(10) NOT NULL,
DIEUKIEN NVARCHAR2(200),
UUDAI NVARCHAR2(200),
Constraint pk_web_maNPH primary key (website,manhaphathanh),
Constraint fk_web_maNPH foreign key (website) references
Nentang,
Constraint fk_maNPH_web foreign key (manhaphathanh)
references Nhaphathanhgame
);
CREATE TABLE Donate
(
MASTREAMER NVARCHAR2(10) NOT NULL,
WEBCONG NVARCHAR2(50) NOT NULL,
SOTIEN number,
THOIDIEMDONATE DATE,
LOINHAN NVARCHAR2(200),
Constraint pk_mastreamer_WebCong primary key
(mastreamer,webcong),
Constraint fk_webcong_mastreamer foreign key (webcong)
references Congdonate,
Constraint fk_streamer_webcong foreign key (mastreamer)
references Streamer
);
7
1.3. Nhập dữ liệu
CREATE TABLE SuDung
(
WEBSITE NVARCHAR2(50) NOT NULL,
MASTREAMER NVARCHAR2(10) NOT NULL,
TENTAIKHOAN NVARCHAR2(50) NOT NULL,
SUBCRIBER number,
Constraint pk_mastreamer_website primary key (mastreamer,
website),
Constraint fk_streamer_website foreign key (mastreamer)
references Streamer,
Constraint fk_webite_streamer foreign key (website) r
references Nentang
);
-----------Streamer-------------
Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan,
ngaysinh, sodienthoai)
values ('ST01', 'Phung Thanh Do', 'Nam', 'Cao Bang',
to_date('12/09/1989','dd/mm/yyyy'), ‘0965698119’);
Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan,
ngaysinh, sodienthoai)
values ('ST02', 'Hoang Van Khoa', 'Nam', 'Hai Phong',
to_date('23/06/1991','dd/mm/yyyy'), '0398549916');
Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan,
ngaysinh, sodienthoai)
values ('ST03', 'Dang Tien Hoang', 'Nam', 'Ha Noi',
to_date('08/05/1990','dd/mm/yyyy'), '0968510396');
Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan,
ngaysinh, sodienthoai)
values ('ST04', 'Nghiem Anh Hieu', 'Nam', 'England',
to_date('27/04/1989','dd/mm/yyyy'), '0976483772');
Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan,
ngaysinh, sodienthoai)
values ('ST05', 'Pham Thuy Trang', 'Nu', 'Ho Chi Minh',
to_date('04/11/2002','dd/mm/yyyy'), '0356785654');
Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan,
ngaysinh, sodienthoai)
values ('ST06', 'Lam Dinh Khoa', 'Nam', 'Cao Lanh',
to_date('24/05/1996','dd/mm/yyyy'), '0393244111');
Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan,
ngaysinh, sodienthoai)
values ('ST07', 'Dam Ngoc Linh', 'Nu', 'Ha Noi',
to_date('08/06/1996','dd/mm/yyyy'), '0808061996');
Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan,
ngaysinh, sodienthoai)
values ('ST08', 'Tran Thai Linh', 'Nam', 'Ha Noi',
to_date('16/06/1997','dd/mm/yyyy'), '0975356889');
Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan,
ngaysinh, sodienthoai)
values ('ST09', 'Nguyen Van Thuan', 'Nam', 'America',
to_date('17/12/1995','dd/mm/yyyy'), '0923457854');
8
Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan,
ngaysinh, sodienthoai)
values ('ST10', 'Tran Manh Quang', 'Nam', 'Ha Noi',
to_date('13/11/1994','dd/mm/yyyy'), '0513111994');
-----------NhaPhatHanhGame---------
Insert into Nhaphathanhgame (manhaphathanh, tennhaphathanh,
diachiweb)
values ('VNG', 'Vinagame', 'vinagame.com');
Insert into Nhaphathanhgame (manhaphathanh, tennhaphathanh,
diachiweb)
values ('VTCG', 'VTC game', 'vtcgame.com');
Insert into Nhaphathanhgame (manhaphathanh, tennhaphathanh,
diachiweb)
values ('GRN', 'Garena Vietnam', 'garena.com');
-------------CongDonate--------
Insert into Congdonate (webcong, tencong, tilechietkhau)
values ('Unghotoi.com', 'Ung ho toi', '15');
Insert into Congdonate (webcong, tencong, tilechietkhau)
values ('Streamlabs.com', 'Streamlab', '10');
Insert into Congdonate (webcong, tencong, tilechietkhau)
values ('Playerdou.com', 'Playerdou', '11.1');
----------Donater-------------
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT01', 'Huyhara', '200000', 'Unghotoi.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT02', 'Chuchoa', '234567', 'Streamlabs.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT03', 'Lanhconyxin', '123987', 'Unghotoi.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT04', 'Bthahbthongdoc', '9876543', 'Playerdou.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT05', 'Miuxinh', '555555', 'Streamlabs.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT06', 'Chautinhbo', '357913', 'Playerdou.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT07', 'Khibg', '20202020', 'Streamlabs.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT08', 'Phungthailinh', '444444', 'Playerdou.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT09', 'Thailinhhuong', '979797', 'Playerdou.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT10', 'Thayonip', '9999991', 'Streamlabs.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT11', 'Tudu', '686868', 'Playerdou.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT12', 'Maydapnghean', '377337', 'Unghotoi.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT13', 'Khoimom', '787878', 'Playerdou.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT14', 'Toisung', '551102', 'Streamlabs.com');
Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong)
values ('DT15', 'Nhunhi', '2222222', 'Unghotoi.com');
---------Game--------------
Insert into Game (magame, manhaphathanh, tengame, theloai,
linkdownload, dungluong)
values ('G01', 'GRN', 'League of legend', 'Chien thuat', 'lol.exe',
'11.7GB');
Insert into Game (magame, manhaphathanh, tengame, theloai,
linkdownload, dungluong)
values ('G02', 'VNG', 'PUBG', 'Dong doi', 'pubg.exe', '15.03GB');
9
Insert into Game (magame, manhaphathanh, tengame, theloai,
linkdownload, dungluong)
values ('G03', 'VNG', 'CF', 'Tactic', 'cf.exe', '7.65GB');
Insert into Game (magame, manhaphathanh, tengame, theloai,
linkdownload, dungluong)
values ('G04', 'VTCG', 'Audition', 'Music', 'au.exe', '3.63GB');
Insert into Game (magame, manhaphathanh, tengame, theloai,
linkdownload, dungluong)
values ('G05', 'GRN', 'Fifa online', 'Sport','fifa.exe', '10.98GB');
------------Nen Tang---------
Insert into Nentang (website, tennentang, mobileapp)
values ('nimo.tv', 'Nimo', 'Nimo TV app');
Insert into Nentang (website, tennentang, mobileapp)
values ('youtube.com', 'YouTube', 'YouTube');
--------------Choi------------
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST01', 'G01', TO_DATE('07/09/2020 11:30:25','dd/mm/yyyy
HH:MI:SS'), TO_DATE('08/09/2020 3:50:33','dd/mm/yyyy HH:MI:SS'));
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST01', 'G02', TO_DATE('12/09/2020 10:57:58','dd/mm/yyyy
HH:MI:SS'), TO_DATE('13/09/2020 4:50:11','dd/mm/yyyy HH:MI:SS'));
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST06', 'G05', TO_DATE('10/09/2020 8:30:25','dd/mm/yyyy
HH:MI:SS'), TO_DATE('10/09/2020 9:50:25','dd/mm/yyyy HH:MI:SS'));
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST07', 'G03', TO_DATE('11/09/2020 7:30:25','dd/mm/yyyy
HH:MI:SS'), TO_DATE('11/09/2020 9:33:25','dd/mm/yyyy HH:MI:SS'));
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST04', 'G02', TO_DATE('09/09/2020 7:13:26','dd/mm/yyyy
HH:MI:SS'), TO_DATE('09/09/2021 9:22:31','dd/mm/yyyy HH:MI:SS'));
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST02', 'G01', TO_DATE('13/09/2020 9:30:22','dd/mm/yyyy
HH:MI:SS'), TO_DATE('13/09/2020 11:20:20','dd/mm/yyyy HH:MI:SS'));
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST01', 'G04', TO_DATE('10/09/2020 11:30:25','dd/mm/yyyy
HH:MI:SS'), TO_DATE('11/09/2020 5:10:34','dd/mm/yyyy HH:MI:SS'));
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST08', 'G01', TO_DATE('09/09/2020 8:33:22','dd/mm/yyyy
HH:MI:SS'), TO_DATE('09/09/2020 11:50:25','dd/mm/yyyy HH:MI:SS'));
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST03', 'G05', TO_DATE('12/09/2020 9:30:25','dd/mm/yyyy
HH:MI:SS'), TO_DATE('12/09/2020 11:55:25','dd/mm/yyyy HH:MI:SS'));
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST01', 'G03', TO_DATE('11/09/2020 11:03:13','dd/mm/yyyy
HH:MI:SS'), TO_DATE('12/09/2020 2:34:56','dd/mm/yyyy HH:MI:SS'));
Insert into Choi (mastreamer, magame, thoidiembatdau,
thoidiemketthuc)
values ('ST05', 'G02', TO_DATE('07/09/2020 3:22:25','dd/mm/yyyy
HH:MI:SS'), TO_DATE('07/09/2020 5:55:40','dd/mm/yyyy HH:MI:SS'));
10
----------- SuDung----------
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('nimo.tv', 'ST01', 'Mixigaming', 1486278);
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('nimo.tv', 'ST02', 'Pewpew', 456823);
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('nimo.tv', 'ST03', 'Viruss', 289654);
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('nimo.tv', 'ST04', 'Xeme', 678145);
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('youtube.com', 'ST05', 'Xoainon', 197356);
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('youtube.com', 'ST06', 'Tuitenbo', 1394568);
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('youtube.com', 'ST07', 'LinhNgocDam', 3567189);
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('youtube.com', 'ST08', 'Nhism', 789245);
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('youtube.com', 'ST09', 'Snake', 478123);
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('youtube.com', 'ST10', 'QNT', 570234);
Insert into Sudung (website, mastreamer, tentaikhoan, subcriber)
values ('youtube.com', 'ST01', 'Mixigaming', 4892454);
----------------HopTac-----------
Insert into Hoptac (website, manhaphathanh, dieukien,uudai)
values ('nimo.tv', 'VNG', 'Tang 3% tai khoan moi trong thang dau',
'Tang 20% gia tri nap game');
Insert into Hoptac (website, manhaphathanh, dieukien,uudai)
values ('nimo.tv', 'GRN', '100+ live stream game moi ngay', 'Giam gia
10% gia tri do trong shop game (co cong don voi su kien game)');
Insert into Hoptac (website, manhaphathanh, dieukien,uudai)
values ('nimo.tv', 'VTCG', '10000+ luot xem live stream game moi
ngay', 'Mien phi 3 do bat ki trong shop game');
Insert into Hoptac (website, manhaphathanh, dieukien,uudai)
values ('youtube.com', 'GRN', 'Tang 3% tai khoan moi trong thang
dau', 'Giam gia 15% gia tri do trong shop game (co cong don voi su
kien game)');
-----------Donate------------
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST01', 'Playerdou.com', 101101, to_date('09/09/2020
10:50:25','dd/mm/yyyy HH:MI:SS'), 'Cac anh choi game gi the a');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST01', 'Unghotoi.com', 10000000, to_date('09/09/2020
11:30:25','dd/mm/yyyy HH:MI:SS'), 'Hom nao moi anh em qua quan toi
nhe');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST01', 'Streamlabs.com', 300000, to_date('11/09/2020
5:30:25','dd/mm/yyyy HH:MI:SS'), 'Hom nay stream muon the ong:)))');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST02', 'Streamlabs.com', 100000, to_date('07/09/2020
10:01:42','dd/mm/yyyy HH:MI:SS'), 'Nghe noi Hai Phong nhieu giang ho
dung khong anh?');
11
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST02', 'Unghotoi.com', 8000, to_date('09/09/2020
8:32:21','dd/mm/yyyy HH:MI:SS'), 'Anh mo chi nhanh o Ha Noi
diiii:(((');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST03', 'Unghotoi.com', 321456, to_date('10/09/2020
5:05:05','dd/mm/yyyy HH:MI:SS'), 'Bao gio thi anh dinh lay chi Ngan a
=)))');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST04', 'Playerdou.com', 20000, to_date('13/09/2020
10:15:09','dd/mm/yyyy HH:MI:SS'), 'Anh Hieu gio noi tieng Viet khong
soi roi:))');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST05', 'Unghotoi.com', 10000, to_date('12/09/2020
3:33:59','dd/mm/yyyy HH:MI:SS'), 'Trang xinh nhu kieu con lai y.
Theeeee');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST06', 'Unghotoi.com', 8000, to_date('10/09/2020
7:30:22','dd/mm/yyyy HH:MI:SS'), 'Du ca the gioi co quay lung lai voi
anh thi em mai ben canh anh, anh Nhism');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST06', 'Playerdou.com', 500000, to_date('10/09/2020
8:02:52','dd/mm/yyyy HH:MI:SS'), 'Donate mo hom nhe.hi');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST07', 'Streamlabs.com', 10000, to_date('09/09/2020
2:15:07','dd/mm/yyyy HH:MI:SS'), 'Anh chi cute zl luon a.hix');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST08', 'Unghotoi.com', 8000, to_date('11/09/2020
8:10:01','dd/mm/yyyy HH:MI:SS'), 'MVP Viet Nam day = ))))))');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST08', 'Streamlabs.com', 200000, to_date('11/09/2020
9:09:18','dd/mm/yyyy HH:MI:SS'), 'Top 1 donate 1 cu nha');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST09', 'Playerdou.com', 50000, to_date('07/09/2020
12:30:24','dd/mm/yyyy HH:MI:SS'), 'Anh Ben hay qua troiii');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST09', 'Unghotoi.com', 20000, to_date('09/09/2020
1:03:51','dd/mm/yyyy HH:MI:SS'), 'Dinh gia moi loai xe');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST10', 'Unghotoi.com', 50000, to_date('12/09/2020
12:05:19','dd/mm/yyyy HH:MI:SS'), 'Nhac banh cuon qua anh zai');
Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate,
loinhan)
values ('ST10', 'Streamlabs.com', 8000, to_date('12/09/2020
12:10:25','dd/mm/yyyy HH:MI:SS'), 'So litttt');
12
1.4. Phân vùng dữ liệu
2. Thực hiện yêu cầu truy vấn
Công ty cần thường xuyên thực hiện các truy vấn dữ liệu nhằm quản lý và
đánh giá hiệu quả công việc của các setreamer thuộc công ty mình.
2.1. Danh sách tổng số tiền được donate của mỗi streamer
2.2. Top 5 streamer có tổng số tiền donate nhiều nhất
select mastreamer from (select mastreamer,sum(sotien)
from donate
group by mastreamer
order by sum(sotien) desc )
where rownum<=5;
select mastreamer,sum(sotien) "Tong tien donate"
from donate
group by mastreamer;
alter table Nentang move tablespace myspace1;
alter table Hoptac move tablespace myspace1;
alter table Nhaphathanhgame move tablespace myspace1;
alter table Game move tablespace myspace1;
alter table Streamer move tablespace myspace1;
alter table Congdonate move tablespace myspace1;
alter table Sudung move tablespace myspace2;
alter table Choi move tablespace myspace2;
alter table Donate move tablespace myspace2;
alter table Donater move tablespace myspace2;
13
2.3. Top 3 streamer có lượt subcribe cao nhất
2.4. Đưa ra tên streamer trẻ nhất
2.5. Độ tuổi trung bình của các streamer nam
select mastreamer from (select mastreamer,sum(subcriber)
from sudung
group by mastreamer
order by sum(subcriber) desc )
where rownum<=3;
select mastreamer,tenstreamer
from Streamer
where extract(year from ngaysinh)=
(select min(extract( year from ngaysinh)) from streamer);
select round(avg(extract( year from sysdate)-extract( year from
ngaysinh))) as "Tuoi TB"
from Streamer
where gioitinh='Nam';
14
2.6. Số game đã phát hành của mỗi nhà phát hành
2.7. Sắp xếp số dư tài khoản của các donater giảm dần
2.8. Đưa ra cổng donate có tỉ lệ chiết khấu thấp nhất
2.9. Đưa ra thông tin người donate gần nhất
select tentaikhoan, sodutaikhoan
from donater
order by sodutaikhoan desc;
select manhaphathanh,count(magame) as sogame
from Game
group by manhaphathanh;
select webcong
from congdonate where tilechietkhau = (select min(tilechietkhau)
from congdonate)
select tenstreamer from (select tenstreamer from streamer join
donate
on streamer.mastreamer = donate.mastreamer
order by thoidiemdonate desc )
where rownum<=1
15
2.10. Số tiền được donate nhiều nhất của mỗi cổng trong 1 lần
3. Thực hiện yêu cầu nghiệp vụ
Các yêu cầu nghiệp vụ cũng thường xuyên được thực hiện trong trường
hợp cần tìm kiếm thông tin, kết quả của từng đối tượng hoặc nhóm đối tượng cụ
thể.
3.1. Đưa ra thông tin streamer chơi, biết mã game
select webcong, max(sotien)
from donate
group by webcong;
Set serveroutput on
declare
stm streamer%rowtype;
ma_g game.magame% type;
cursor mag_cursor is select
streamer.mastreamer,tenstreamer,gioitinh,quequan,ngaysinh,
sodienthoai
from streamer join choi on streamer.mastreamer = choi.mastreamer
where choi.magame = ma_g;
dem number;
begin
ma_g := '&ma_g';
select count(magame) into dem from game where magame = ma_g;
if(dem = 0) then
dbms_output.put_line('ko co ma game '|| ma_g);
else
dbms_output.put_line('danh sach streamer choi game co ma '||
ma_g||':');
open mag_cursor;
loop
fetch mag_cursor into stm.mastreamer, stm.tenstreamer,
stm.gioitinh,stm.quequan, stm.ngaysinh, stm.sodienthoai;
exit when mag_cursor%notfound;
16
3.2. Đưa ra thông tin nhà phát hành, biết mã game
dbms_output.put_line('ma streamer: '||stm.mastreamer||
' ten streamer:'||stm.tenstreamer||' gioi tinh: '||
stm.gioitinh||'que quan: '|| stm.quequan||' ngay sinh: '||
stm.ngaysinh||' so dien thoai:'||stm.sodienthoai);
end loop;
end if;
close mag_cursor;
end;
set serveroutput on
create or replace function NPH
(ma_g game.magame%type)
return nvarchar2
as tenNPH nhaphathanhgame.tennhaphathanh%type;
maNPH nhaphathanhgame.manhaphathanh%type;
dem int;
begin
select count(magame) into dem from game where magame = ma_g;
if(dem=0) then
tenNPH:='Ma game khong hop le';
else select manhaphathanh into maNPH from game
where magame=ma_g;
select tennhaphathanh into tenNPH from nhaphathanhgame
where manhaphathanh=maNPH;
end if;
return tenNPH;
end;
--chạy function
declare ma game.magame%type;
t nhaphathanhgame.tennhaphathanh%type;
begin
ma:='&ma';
t:=NPH(ma);
dbms_output.put_line('Ten nha phat hanh la: '||t);
end;
17
3.3. Đưa ra thông tin donater, biết website cổng donate.
3.4. Đưa ra tỉ lệ phần trăm giới tính được nhập
set serveroutput on
declare
dnt donater%rowtype;
wc donater.webcong% TYPE;
cursor wc_cursor is select * from donater where webcong = wc;
dem number;
begin
wc := '&wc';
select count(wc) into dem from congdonate where webcong = wc;
if(dem = 0) then
dbms_output.put_line('ko co web cong '|| WC);
else
open wc_cursor;
loop fetch wc_cursor into dnt.madonater, dnt.webcong,
dnt.tentaikhoan, dnt.sodutaikhoan ;
exit when wc_cursor%notfound;
dbms_output.put_line('ma donater: '|| dnt.madonater ||' web cong
: '||wc||' ten tai khoan: '|| dnt.tentaikhoan || ' so du tai khoan:
'||dnt.sodutaikhoan);
end loop;
end if;
close wc_cursor;
end;
set serveroutput on
create or replace procedure tilegioitinh(
g_t streamer.gioitinh% type)
dem number;
tong number;
phantram number;
begin
select count(mastreamer) into tong from streamer;
select count(gioitinh) into dem
from streamer where gioitinh = g_t;
phantram := (dem/tong)*100;
dbms_output.put_line('gioi tinh '||g_t||' chiem '||phantram||'%');
end;
exce tilegioitinh(&g_t);
18
3.5. Đưa ra danh sách streamer sử dụng nền tảng, biết website nền tảng
3.6. Đưa ra thông tin streamer, biết quê quán
set serveroutput on
declare
ws sudung.website% TYPE;
ten_tk sudung.tentaikhoan% type;
dem number;
cursor ws_cursor is select tentaikhoan from sudung where website =ws;
begin
ws := '&ws';
select count(website) into dem from nentang where website = ws;
if(dem = 0) then
dbms_output.put_line('khong co website nay');
else
dbms_output.put_line('danh sach cac streamer lam viec voi
'||ws||':');
open ws_cursor ;
loop
fetch ws_cursor into ten_tk;
exit when ws_cursor%notfound;
dbms_output.put_line(ten_tk);
end loop;
end if;
close ws_cursor;
end;
set serveroutput on
declare
stm streamer%rowtype;
que_quan streamer.quequan%TYPE;
cursor stm_cursor is select * from streamer
where quequan = que_quan;
begin
que_quan := '&que_quan';
open stm_cursor;
loop
fetch stm_cursor into stm.mastreamer, stm.tenstreamer,
stm.gioitinh,stm.quequan, stm.ngaysinh, stm.sodienthoai;
exit when stm_cursor%notfound;
dbms_output.put_line('ma streamer: '||stm.mastreamer||' ten
streamer:'||stm.tenstreamer||' gioi tinh: '|| stm.gioitinh||' que
quan: '|| stm.quequan||' ngay sinh: '|| stm.ngaysinh||' so dien
thoai:'||stm.sodienthoai);
end loop;
close stm_cursor;
end;
19
3.7. Đưa ra thông tin streamer, biết mã streamer đó
3.8. Thống kê thứ hạng những game mà streamer đã chơi nhiều, thứ hạng
set serveroutput on
declare
ma streamer.mastreamer%type;
ten streamer.tenstreamer%type;
gt streamer.gioitinh%type;
qq streamer.quequan%type;
ns streamer.ngaysinh%type;
sdt streamer.sodienthoai%type;
kt int;
begin
ma:='&ma';
select count(mastreamer) into kt from streamer where mastreamer=ma;
if(kt!=0) then
select tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai into
ten,gt,qq,ns,sdt from streamer where mastreamer=ma;
dbms_output.put_line('Thong tin streamer co ma '||ma||' Ten: '||
ten||', gioi tinh '||gt||', que quan '||qq||', ngay sinh
'||ns||', so dien thoai '||sdt);
else
dbms_output.put_line('Ma streamer khong hop le');
end if;
end;
set serveroutput on
declare
n int;
begin
n:=&n;
dbms_output.put_line('Top '||n||' game duoc nhieu nguoi choi la: ');
for numtb in (select magame from (select magame, count(mastreamer)
from game join choi using(magame) group by magame
order by count(mastreamer) desc) where rownum<=n)
loop
dbms_output.put_line(numtb.magame||' ');
end loop;
end;
20
3.9. Đưa ra số tiền các lần được donate của streamer, biết mã streamer
3.10. Đưa ra số donater đã nạp tiền, biết website cổng donate
set SERVEROUTPUT ON
declare ma_streamer streamer.mastreamer%type;
tien donate.sotien%type;
cursor cur_str is select b.sotien from streamer a inner join donate b
on a.mastreamer=b.mastreamer
where a.mastreamer=ma_streamer;
solan int:=1;
begin
ma_streamer:='&ma_streamer';
dbms_output.put_line('Mastreamer: '||ma_streamer);
open cur_str;
loop
fetch cur_str into tien;
exit when cur_str%notfound;
dbms_output.put_line(' lan '||solan||' duoc Donate '||tien);
solan:=solan+1;
end loop;
close cur_str;
end;
set SERVEROUTPUT ON
create or replace procedure tongluotnap
(web donater.webcong%type)
as
soluong number;
dem int;
begin
select count(webcong) into dem from donater
where webcong = web;
if(dem=0) then dbms_output.put_line ('Web khong hop le');
else
select count(madonater) into soluong
from donater where webcong=web;
dbms_output.put_line('So donater da dung web cong '||web||' la: '
||soluong);
end if;
end;
exec tongluotnap(&web);
21
4. Thực hiện quản trị cơ sở dữ liệu
4.1. Tạo user
Hệ thống được sử dụng bởi:
- Người quản lý: có toàn quyền trên cơ sở dữ liệu. Thực hiện các công việc
như backup CSDL, giải quyết sự cố nếu có vấn đề xảy ra với CSDL.
- Streamer và người xem: chỉ có quyền xem thông tin.
Create USER managerCreatory IDENTIFIED BY Creatory;
Grant CONNECT,RESOURCE,DBA to managerCreatory;
Alter user managerCreatory quota unlimited on myspace1;
Alter user managerCreatory quota unlimited on myspace2;
ALTER USER managerCreatory
DEFAULT TABLESPACE users;
ALTER USER managerCreatory
TEMPORARY TABLESPACE temp;
Grant unlimited tablespace to managercreatory;
Create user viewer identified by 123;
Alter user viewer quota unlimited on myspace1;
Alter user viewer quota unlimited on myspace2;
Grant create session to viewer;
Grant create view to viewer;
Grant unlimited tablespace to viewer;
GRANT SELECT ANY TABLE TO viewer;
ALTER USER viewer
DEFAULT TABLESPACE users;
ALTER USER viewer
TEMPORARY TABLESPACE temp;
22
4.2. Sao lưu (backup)
Backup dữ liệu định kì vào 12h chủ nhật hàng tuần
a. Phương án backup
- Có hai phương án back up: kịch bản back up do DBA tự định nghĩa và
Recovery Manager (RMAN). Với kịch bản backup do DBA tự định nghĩa thì
người quản trị phải tự viết lệnh để thực hiện backup. Việc này phức tạp và tốn
thời gian hơn việc sử dụng RMAN nên với đề tài này, nhóm quyết định dùng
RMAN để backup.
- Được cài đặt cùng với cơ sở dữ liệu, RMAN là một ứng dụng client cơ sở
dữ liệu Oracle thực hiện các nhiệm vụ sao lưu và phục hồi trên cơ sở dữ liệu của
bạn và tự động hóa việc quản trị chiến lược sao lưu. Nó đơn giản hóa đáng kể
việc sao lưu, khôi phục và phục hồi cơ sở dữ liệu.
- Các đặc điểm nổi bật của RMAN:
+ Có các hàm để chạy lệnh backup.
+ Có API để tương thích với các phần mềm backup.
+ Có thể backup data file, control file, archived log, parameter file.
+ Có thể backup dữ liệu ra đĩa hoặc băng từ.
+ Cung cấp cấp báo cáo chi tiết về các hoạt động sao lưu.
+ Chỉ RMAN cung cấp khả năng thực hiện sao lưu mã hóa.
Ở đề tài này, nhóm sẽ sử dụng RMAN thông qua EM.
b. Chiến lược backup
- Gồm: + Backup toàn bộ database
Grant select on managerCreatory.game to viewer;
Grant select on managerCreatory.donate to viewer;
Grant select on managerCreatory.donater to viewer;
Grant select on managerCreatory.nhaphathanhgame to viewer;
Grant select on managerCreatory.streamer to viewer;
Grant select on managerCreatory.congdonate to viewer;
Grant select on managerCreatory.hoptac to viewer;
Grant select on managerCreatory.sudung to viewer;
23
+ Backup một phần
- Nhóm lựa chọn backup toàn bộ database để giúp ích cho việc phục hồi
sau này.
c. Chế độ backup
- Gồm: + Cold/Consistent (nguội): tiến hành khi database đóng
+ Hot/Inconsistent (nóng): tiến hành khi database mở
- Nhóm sử dụng hot backup (online backup) vì mỗi khi có sự thay đổi dữ
liệu sẽ được ghi vào Redo log files. Vì vậy, khi phục hồi sẽ không bị mất nhiều
dữ liệu. Để sử dụng online backup, cần phải đảm bảo cơ sở dữ liệu đang ở chế
độ Archive log mode. Khi đó, ta có thể khôi phục tập tin hoặc khôi phục lại bản
sao lưu và áp dụng các Archive log mode.
d. Loại backup
- Incremental backup (sao lưu gia tăng): là backup những gì thay đổi so với
lần incremental backup gần nhất
- Nhóm quyết định chọn incremental backup vì:
+ Thời gian backup nhanh
+ Dung lượng backup ít hơn
e. Các bước tiến hành backup
(1) Bật chế độ ARCHIVELOG để có thể thực hiện Online backup.
24
(2) Backup toàn bộ CSDL (Whole Database).
(3) Chọn Schedule Customized Backup để lên lịch sao lưu.
(4) Setting
25
(5) Schedule
(6) Review
Chọn Submit Job để hoàn tất.
26
4.3. Phục hồi (recovery)
- Trong quá trình sử dụng, database có thể xuất hiện những lỗi như sau:
+ Statement failure
+ User process failure
+ Network failure
+ User or application error
+ Instance failure
+ Media failure
- Những lỗi trên có thể xảy ra khi mất control file, data file hoặc một nhóm
redo log,… Ở đây, nhóm đưa ra cách khắc phục khi bị mất control file và data
file.
a. Khắc phục khi mất control file (khôi phục từ AutoBackup)
(1) Tắt database (nếu đang mở)
RMAN → shutdown immediate;
RMAN → startup nomount;
(2) Khôi phục lại control file bằng cách copy control file đã backup
RMAN → restore controlfile from autobackup;
RMAN → alter database mount;
RMAN → recover database;
(3) Khởi động lại database
Alter database open resetlogs;
b. Khắc phục khi mất data file
- TH1: Database ở chế độ NOARCHIVELOG (bất kì data file nào bị mất)
(1) Tắt database (nếu đang mở)
27
RMAN → shutdown immediate;
RMAN → startup nomount;
(2) Phục hồi lại toàn bộ database, bao gồm: data file, control file
RMAN → restore datafile ‘corrupted_data_file_name_path’1
;
RMAN → restore controlfile from autobackup;
RMAN → recover database;
(3) Khởi động lại database
Alter database open resetlogs;
- TH2: Database ở chế độ ARCHIVELOG
+ Nếu không thuộc tablespace system&undo
+ Nếu thuộc tablespace system&undo
(1) Tắt database theo chế độ SHUTDOWN ABORT
(2) Mount database
Startup mount;
(3) Phục hồi data flie bị mất
(4) Mở lại database
1
Đường chỉ dẫn đến data file bị hỏng
28
III. Kết luận
1. Ưu điểm
Bài làm của nhóm về cơ bản đã xây dựng được cơ sở dữ liệu phục vụ cho
công việc quản lý trong lĩnh vực game livestreaming.
- Thông tin được lưu trữ có hệ thống: liên kết giữa các bảng được đơn giản
hóa và tối ưu, giúp công việc tạo lập, lưu trữ, truy xuất được thực hiện chính
xác, nhanh chóng.
- Đảm bảo an toàn dữ liệu: dữ liệu được phân vùng cụ thể, cấp quyền và
nhóm quyền cho các đối tượng người dùng khác nhau. Ngoài ra, nhóm đã có
phương án sao lưu, phục hồi dữ liệu cụ thể, đảm bảo dữ liệu được lưu trữ trong
thời gian dài.
- Dữ liệu có tính thực tế: các dữ liệu được nêu trong bài là kết quả của quá
trình tìm hiểu, chắt lọc với tính chính xác cao của nhóm. Các truy vấn và thao
tác nghiệp vụ cũng là những thông số, thông tin được đa số người xem quan
tâm.
2. Nhược điểm
Ngoài những ưu điểm đạt được, bài làm vẫn còn nhiều thiếu sót do đây là
lần đầu nhóm cùng nhau tự thực hiện xây dựng một cơ sở dữ liệu về lĩnh vực
khá mới, tài liệu tham khảo còn hạn chế.
- Lĩnh vực game livestreaming còn nhiều mảng nội dung có thể khai thác,
tìm hiểu (lượt xem, tương tác, quảng cáo,…). Nhưng trong khuôn khổ bài tập
lớn, nhóm chưa thể truyền tải đầy đủ đến cô cũng như các bạn về lĩnh vực đầy
tiềm năng này.
- Chưa đưa ra được cách phục hồi các trường hợp phức tạp hơn.

More Related Content

Similar to BTL-CSDL2-streaming.pdf

E-Magazine: Tổng quan Gaming Creators Việt Nam
E-Magazine: Tổng quan Gaming Creators Việt NamE-Magazine: Tổng quan Gaming Creators Việt Nam
E-Magazine: Tổng quan Gaming Creators Việt NamAppota Group
 
Nham duc phuc k50 cnpm_khoa luan tot nghiep dai hoc
Nham duc phuc k50 cnpm_khoa luan tot nghiep dai hocNham duc phuc k50 cnpm_khoa luan tot nghiep dai hoc
Nham duc phuc k50 cnpm_khoa luan tot nghiep dai hocdanielpowter_89
 
nhom1_ITLTU17B_QuanLyThuPhi.docx
nhom1_ITLTU17B_QuanLyThuPhi.docxnhom1_ITLTU17B_QuanLyThuPhi.docx
nhom1_ITLTU17B_QuanLyThuPhi.docxHoangHq1
 
Luận văn thạc sĩ máy tính.
Luận văn thạc sĩ máy tính.Luận văn thạc sĩ máy tính.
Luận văn thạc sĩ máy tính.ssuser499fca
 
Báo cáo thực tập công nghệ thông tin.
Báo cáo thực tập công nghệ thông tin.Báo cáo thực tập công nghệ thông tin.
Báo cáo thực tập công nghệ thông tin.ssuser499fca
 
Tìm hiểu framework Spring cho Backend, Reactjs cho frontend và xây dựng websi...
Tìm hiểu framework Spring cho Backend, Reactjs cho frontend và xây dựng websi...Tìm hiểu framework Spring cho Backend, Reactjs cho frontend và xây dựng websi...
Tìm hiểu framework Spring cho Backend, Reactjs cho frontend và xây dựng websi...Man_Ebook
 
Bai giang tin_hoc_ql_2_046
Bai giang tin_hoc_ql_2_046Bai giang tin_hoc_ql_2_046
Bai giang tin_hoc_ql_2_046Heo Mọi
 
NHÓM 6_ĐỀ CƯƠNG DỰ ÁN (1).pdf
NHÓM 6_ĐỀ CƯƠNG DỰ ÁN (1).pdfNHÓM 6_ĐỀ CƯƠNG DỰ ÁN (1).pdf
NHÓM 6_ĐỀ CƯƠNG DỰ ÁN (1).pdfPhongNguyn710309
 
Phân tích thiết kế hệ thống của hàng bán điện thoại di động
Phân tích thiết kế hệ thống của hàng bán điện thoại di độngPhân tích thiết kế hệ thống của hàng bán điện thoại di động
Phân tích thiết kế hệ thống của hàng bán điện thoại di độngNguyễn Danh Thanh
 
Giải pháp Social Listening
Giải pháp Social ListeningGiải pháp Social Listening
Giải pháp Social ListeningMil Nguyen
 
đề Thi chứng chỉ tin học quốc gia trình độ a 1
đề Thi chứng chỉ tin học quốc gia trình độ a 1đề Thi chứng chỉ tin học quốc gia trình độ a 1
đề Thi chứng chỉ tin học quốc gia trình độ a 1Học Huỳnh Bá
 
Sử dụng thông tin đồ họa trên báo điện tử hiện nay 6790778.pdf
Sử dụng thông tin đồ họa trên báo điện tử hiện nay 6790778.pdfSử dụng thông tin đồ họa trên báo điện tử hiện nay 6790778.pdf
Sử dụng thông tin đồ họa trên báo điện tử hiện nay 6790778.pdfNuioKila
 

Similar to BTL-CSDL2-streaming.pdf (20)

E-Magazine: Tổng quan Gaming Creators Việt Nam
E-Magazine: Tổng quan Gaming Creators Việt NamE-Magazine: Tổng quan Gaming Creators Việt Nam
E-Magazine: Tổng quan Gaming Creators Việt Nam
 
Cheat book
Cheat bookCheat book
Cheat book
 
Nham duc phuc k50 cnpm_khoa luan tot nghiep dai hoc
Nham duc phuc k50 cnpm_khoa luan tot nghiep dai hocNham duc phuc k50 cnpm_khoa luan tot nghiep dai hoc
Nham duc phuc k50 cnpm_khoa luan tot nghiep dai hoc
 
nhom1_ITLTU17B_QuanLyThuPhi.docx
nhom1_ITLTU17B_QuanLyThuPhi.docxnhom1_ITLTU17B_QuanLyThuPhi.docx
nhom1_ITLTU17B_QuanLyThuPhi.docx
 
Luận văn thạc sĩ máy tính.
Luận văn thạc sĩ máy tính.Luận văn thạc sĩ máy tính.
Luận văn thạc sĩ máy tính.
 
Báo cáo thực tập công nghệ thông tin.
Báo cáo thực tập công nghệ thông tin.Báo cáo thực tập công nghệ thông tin.
Báo cáo thực tập công nghệ thông tin.
 
Tìm hiểu framework Spring cho Backend, Reactjs cho frontend và xây dựng websi...
Tìm hiểu framework Spring cho Backend, Reactjs cho frontend và xây dựng websi...Tìm hiểu framework Spring cho Backend, Reactjs cho frontend và xây dựng websi...
Tìm hiểu framework Spring cho Backend, Reactjs cho frontend và xây dựng websi...
 
Xây dựng chiến lược Digital Marketing cho sản phẩm Nhà, HAY!
Xây dựng chiến lược Digital Marketing cho sản phẩm Nhà, HAY!Xây dựng chiến lược Digital Marketing cho sản phẩm Nhà, HAY!
Xây dựng chiến lược Digital Marketing cho sản phẩm Nhà, HAY!
 
Quản lý marketing online cho các thương hiệu đặc sản Việt nam
Quản lý marketing online cho các thương hiệu đặc sản Việt namQuản lý marketing online cho các thương hiệu đặc sản Việt nam
Quản lý marketing online cho các thương hiệu đặc sản Việt nam
 
Quản lý marketing online cho các thương hiệu đặc sản của Việt nam
Quản lý marketing online cho các thương hiệu đặc sản của Việt namQuản lý marketing online cho các thương hiệu đặc sản của Việt nam
Quản lý marketing online cho các thương hiệu đặc sản của Việt nam
 
Bai giang tin_hoc_ql_2_046
Bai giang tin_hoc_ql_2_046Bai giang tin_hoc_ql_2_046
Bai giang tin_hoc_ql_2_046
 
NHÓM 6_ĐỀ CƯƠNG DỰ ÁN (1).pdf
NHÓM 6_ĐỀ CƯƠNG DỰ ÁN (1).pdfNHÓM 6_ĐỀ CƯƠNG DỰ ÁN (1).pdf
NHÓM 6_ĐỀ CƯƠNG DỰ ÁN (1).pdf
 
Proposal Website GameHay.net.vn
Proposal Website GameHay.net.vnProposal Website GameHay.net.vn
Proposal Website GameHay.net.vn
 
Phân tích thiết kế hệ thống của hàng bán điện thoại di động
Phân tích thiết kế hệ thống của hàng bán điện thoại di độngPhân tích thiết kế hệ thống của hàng bán điện thoại di động
Phân tích thiết kế hệ thống của hàng bán điện thoại di động
 
Giải pháp Social Listening
Giải pháp Social ListeningGiải pháp Social Listening
Giải pháp Social Listening
 
Đề tài: Xây dựng hệ thống tổng hợp thông tin kinh tế xã hội
Đề tài: Xây dựng hệ thống tổng hợp thông tin kinh tế xã hộiĐề tài: Xây dựng hệ thống tổng hợp thông tin kinh tế xã hội
Đề tài: Xây dựng hệ thống tổng hợp thông tin kinh tế xã hội
 
đề Thi chứng chỉ tin học quốc gia trình độ a 1
đề Thi chứng chỉ tin học quốc gia trình độ a 1đề Thi chứng chỉ tin học quốc gia trình độ a 1
đề Thi chứng chỉ tin học quốc gia trình độ a 1
 
Sử dụng thông tin đồ họa trên báo điện tử hiện nay 6790778.pdf
Sử dụng thông tin đồ họa trên báo điện tử hiện nay 6790778.pdfSử dụng thông tin đồ họa trên báo điện tử hiện nay 6790778.pdf
Sử dụng thông tin đồ họa trên báo điện tử hiện nay 6790778.pdf
 
SỬ DỤNG THÔNG TIN ĐỒ HỌA TRÊN BÁO ĐIỆN TỬ HIỆN NAY - TẢI FREE ZALO: 093 457 3149
SỬ DỤNG THÔNG TIN ĐỒ HỌA TRÊN BÁO ĐIỆN TỬ HIỆN NAY - TẢI FREE ZALO: 093 457 3149SỬ DỤNG THÔNG TIN ĐỒ HỌA TRÊN BÁO ĐIỆN TỬ HIỆN NAY - TẢI FREE ZALO: 093 457 3149
SỬ DỤNG THÔNG TIN ĐỒ HỌA TRÊN BÁO ĐIỆN TỬ HIỆN NAY - TẢI FREE ZALO: 093 457 3149
 
Báo cáo
Báo cáoBáo cáo
Báo cáo
 

Recently uploaded

Catalog Sino BG - Den chieu sang 2 - 15012024.pdf
Catalog Sino BG - Den chieu sang 2 - 15012024.pdfCatalog Sino BG - Den chieu sang 2 - 15012024.pdf
Catalog Sino BG - Den chieu sang 2 - 15012024.pdfOrient Homes
 
Catalogue Van vòi Novo-Viettiep Chốt.pdf
Catalogue Van vòi Novo-Viettiep Chốt.pdfCatalogue Van vòi Novo-Viettiep Chốt.pdf
Catalogue Van vòi Novo-Viettiep Chốt.pdfOrient Homes
 
Bài tiểu luận môn Marketing dịch vụ Nghiên cứu hoạt động Marketing của doanh ...
Bài tiểu luận môn Marketing dịch vụ Nghiên cứu hoạt động Marketing của doanh ...Bài tiểu luận môn Marketing dịch vụ Nghiên cứu hoạt động Marketing của doanh ...
Bài tiểu luận môn Marketing dịch vụ Nghiên cứu hoạt động Marketing của doanh ...lamluanvan.net Viết thuê luận văn
 
Catalog Sino - Den chieu sang 1 - 15012024.pdf
Catalog Sino - Den chieu sang 1 - 15012024.pdfCatalog Sino - Den chieu sang 1 - 15012024.pdf
Catalog Sino - Den chieu sang 1 - 15012024.pdfOrient Homes
 
Catalogue đèn chiếu sáng TLC 2023.07.pdf
Catalogue đèn chiếu sáng TLC 2023.07.pdfCatalogue đèn chiếu sáng TLC 2023.07.pdf
Catalogue đèn chiếu sáng TLC 2023.07.pdfOrient Homes
 
Catalogue gach Đồng Tâm DongVan_2023.pdf
Catalogue gach Đồng Tâm DongVan_2023.pdfCatalogue gach Đồng Tâm DongVan_2023.pdf
Catalogue gach Đồng Tâm DongVan_2023.pdfOrient Homes
 
HSNL HAPULICO 29.05.2023 (VI) đầy đủ.pdf
HSNL HAPULICO 29.05.2023 (VI) đầy đủ.pdfHSNL HAPULICO 29.05.2023 (VI) đầy đủ.pdf
HSNL HAPULICO 29.05.2023 (VI) đầy đủ.pdfOrient Homes
 
Catalog thiết bị vệ sinh TOTO-GEN_2024.pdf
Catalog thiết bị vệ sinh TOTO-GEN_2024.pdfCatalog thiết bị vệ sinh TOTO-GEN_2024.pdf
Catalog thiết bị vệ sinh TOTO-GEN_2024.pdfOrient Homes
 
Catalogue Thiết bị vệ sinh American Standard mới nhất 2024.pdf
Catalogue Thiết bị vệ sinh American Standard mới nhất 2024.pdfCatalogue Thiết bị vệ sinh American Standard mới nhất 2024.pdf
Catalogue Thiết bị vệ sinh American Standard mới nhất 2024.pdfOrient Homes
 
ASM hoạch định fffffffffffffffffffffffff
ASM hoạch định fffffffffffffffffffffffffASM hoạch định fffffffffffffffffffffffff
ASM hoạch định fffffffffffffffffffffffffVAD Jewelry
 
Catalog thiết bị vệ sinh kohler(part 1-6).pdf
Catalog thiết bị vệ sinh kohler(part 1-6).pdfCatalog thiết bị vệ sinh kohler(part 1-6).pdf
Catalog thiết bị vệ sinh kohler(part 1-6).pdfOrient Homes
 
Catalog Tiền phong Bảng giá PVC 01.07.23.pdf
Catalog Tiền phong Bảng giá PVC 01.07.23.pdfCatalog Tiền phong Bảng giá PVC 01.07.23.pdf
Catalog Tiền phong Bảng giá PVC 01.07.23.pdfOrient Homes
 
Công cụ Trắc nghiệm tính cách MBTI miễn phí
Công cụ Trắc nghiệm tính cách MBTI miễn phíCông cụ Trắc nghiệm tính cách MBTI miễn phí
Công cụ Trắc nghiệm tính cách MBTI miễn phíUy Hoàng
 
Trắc nghiệm khả năng lãnh đạo - Trắc nghiệm ngay!
Trắc nghiệm khả năng lãnh đạo - Trắc nghiệm ngay!Trắc nghiệm khả năng lãnh đạo - Trắc nghiệm ngay!
Trắc nghiệm khả năng lãnh đạo - Trắc nghiệm ngay!Uy Hoàng
 
Catalog BG - ổ cắm, công tắc PK Sino.pdf
Catalog BG - ổ cắm, công tắc PK Sino.pdfCatalog BG - ổ cắm, công tắc PK Sino.pdf
Catalog BG - ổ cắm, công tắc PK Sino.pdfOrient Homes
 
Catalogue Thiết bị điện 2023 TNC .pdf
Catalogue Thiết bị điện 2023 TNC    .pdfCatalogue Thiết bị điện 2023 TNC    .pdf
Catalogue Thiết bị điện 2023 TNC .pdfOrient Homes
 
Từ ETF quốc tế đến ETF tại VN, chúng vận hành như thế nào by Nguyễn Duy Hậu.pdf
Từ ETF quốc tế đến ETF tại VN, chúng vận hành như thế nào by Nguyễn Duy Hậu.pdfTừ ETF quốc tế đến ETF tại VN, chúng vận hành như thế nào by Nguyễn Duy Hậu.pdf
Từ ETF quốc tế đến ETF tại VN, chúng vận hành như thế nào by Nguyễn Duy Hậu.pdfDuyHauNguyen1
 
CATALOG PANASONIC Pricelist 042024 - Vn.pdf
CATALOG PANASONIC Pricelist 042024 - Vn.pdfCATALOG PANASONIC Pricelist 042024 - Vn.pdf
CATALOG PANASONIC Pricelist 042024 - Vn.pdfOrient Homes
 
Cataogue thiết bị vệ sinh inax 042024.NEW.pdf
Cataogue thiết bị vệ sinh inax 042024.NEW.pdfCataogue thiết bị vệ sinh inax 042024.NEW.pdf
Cataogue thiết bị vệ sinh inax 042024.NEW.pdfOrient Homes
 
CATALOG TB điện OPPLE 2023 CATALOGUE.pdf
CATALOG TB điện OPPLE 2023 CATALOGUE.pdfCATALOG TB điện OPPLE 2023 CATALOGUE.pdf
CATALOG TB điện OPPLE 2023 CATALOGUE.pdfOrient Homes
 

Recently uploaded (20)

Catalog Sino BG - Den chieu sang 2 - 15012024.pdf
Catalog Sino BG - Den chieu sang 2 - 15012024.pdfCatalog Sino BG - Den chieu sang 2 - 15012024.pdf
Catalog Sino BG - Den chieu sang 2 - 15012024.pdf
 
Catalogue Van vòi Novo-Viettiep Chốt.pdf
Catalogue Van vòi Novo-Viettiep Chốt.pdfCatalogue Van vòi Novo-Viettiep Chốt.pdf
Catalogue Van vòi Novo-Viettiep Chốt.pdf
 
Bài tiểu luận môn Marketing dịch vụ Nghiên cứu hoạt động Marketing của doanh ...
Bài tiểu luận môn Marketing dịch vụ Nghiên cứu hoạt động Marketing của doanh ...Bài tiểu luận môn Marketing dịch vụ Nghiên cứu hoạt động Marketing của doanh ...
Bài tiểu luận môn Marketing dịch vụ Nghiên cứu hoạt động Marketing của doanh ...
 
Catalog Sino - Den chieu sang 1 - 15012024.pdf
Catalog Sino - Den chieu sang 1 - 15012024.pdfCatalog Sino - Den chieu sang 1 - 15012024.pdf
Catalog Sino - Den chieu sang 1 - 15012024.pdf
 
Catalogue đèn chiếu sáng TLC 2023.07.pdf
Catalogue đèn chiếu sáng TLC 2023.07.pdfCatalogue đèn chiếu sáng TLC 2023.07.pdf
Catalogue đèn chiếu sáng TLC 2023.07.pdf
 
Catalogue gach Đồng Tâm DongVan_2023.pdf
Catalogue gach Đồng Tâm DongVan_2023.pdfCatalogue gach Đồng Tâm DongVan_2023.pdf
Catalogue gach Đồng Tâm DongVan_2023.pdf
 
HSNL HAPULICO 29.05.2023 (VI) đầy đủ.pdf
HSNL HAPULICO 29.05.2023 (VI) đầy đủ.pdfHSNL HAPULICO 29.05.2023 (VI) đầy đủ.pdf
HSNL HAPULICO 29.05.2023 (VI) đầy đủ.pdf
 
Catalog thiết bị vệ sinh TOTO-GEN_2024.pdf
Catalog thiết bị vệ sinh TOTO-GEN_2024.pdfCatalog thiết bị vệ sinh TOTO-GEN_2024.pdf
Catalog thiết bị vệ sinh TOTO-GEN_2024.pdf
 
Catalogue Thiết bị vệ sinh American Standard mới nhất 2024.pdf
Catalogue Thiết bị vệ sinh American Standard mới nhất 2024.pdfCatalogue Thiết bị vệ sinh American Standard mới nhất 2024.pdf
Catalogue Thiết bị vệ sinh American Standard mới nhất 2024.pdf
 
ASM hoạch định fffffffffffffffffffffffff
ASM hoạch định fffffffffffffffffffffffffASM hoạch định fffffffffffffffffffffffff
ASM hoạch định fffffffffffffffffffffffff
 
Catalog thiết bị vệ sinh kohler(part 1-6).pdf
Catalog thiết bị vệ sinh kohler(part 1-6).pdfCatalog thiết bị vệ sinh kohler(part 1-6).pdf
Catalog thiết bị vệ sinh kohler(part 1-6).pdf
 
Catalog Tiền phong Bảng giá PVC 01.07.23.pdf
Catalog Tiền phong Bảng giá PVC 01.07.23.pdfCatalog Tiền phong Bảng giá PVC 01.07.23.pdf
Catalog Tiền phong Bảng giá PVC 01.07.23.pdf
 
Công cụ Trắc nghiệm tính cách MBTI miễn phí
Công cụ Trắc nghiệm tính cách MBTI miễn phíCông cụ Trắc nghiệm tính cách MBTI miễn phí
Công cụ Trắc nghiệm tính cách MBTI miễn phí
 
Trắc nghiệm khả năng lãnh đạo - Trắc nghiệm ngay!
Trắc nghiệm khả năng lãnh đạo - Trắc nghiệm ngay!Trắc nghiệm khả năng lãnh đạo - Trắc nghiệm ngay!
Trắc nghiệm khả năng lãnh đạo - Trắc nghiệm ngay!
 
Catalog BG - ổ cắm, công tắc PK Sino.pdf
Catalog BG - ổ cắm, công tắc PK Sino.pdfCatalog BG - ổ cắm, công tắc PK Sino.pdf
Catalog BG - ổ cắm, công tắc PK Sino.pdf
 
Catalogue Thiết bị điện 2023 TNC .pdf
Catalogue Thiết bị điện 2023 TNC    .pdfCatalogue Thiết bị điện 2023 TNC    .pdf
Catalogue Thiết bị điện 2023 TNC .pdf
 
Từ ETF quốc tế đến ETF tại VN, chúng vận hành như thế nào by Nguyễn Duy Hậu.pdf
Từ ETF quốc tế đến ETF tại VN, chúng vận hành như thế nào by Nguyễn Duy Hậu.pdfTừ ETF quốc tế đến ETF tại VN, chúng vận hành như thế nào by Nguyễn Duy Hậu.pdf
Từ ETF quốc tế đến ETF tại VN, chúng vận hành như thế nào by Nguyễn Duy Hậu.pdf
 
CATALOG PANASONIC Pricelist 042024 - Vn.pdf
CATALOG PANASONIC Pricelist 042024 - Vn.pdfCATALOG PANASONIC Pricelist 042024 - Vn.pdf
CATALOG PANASONIC Pricelist 042024 - Vn.pdf
 
Cataogue thiết bị vệ sinh inax 042024.NEW.pdf
Cataogue thiết bị vệ sinh inax 042024.NEW.pdfCataogue thiết bị vệ sinh inax 042024.NEW.pdf
Cataogue thiết bị vệ sinh inax 042024.NEW.pdf
 
CATALOG TB điện OPPLE 2023 CATALOGUE.pdf
CATALOG TB điện OPPLE 2023 CATALOGUE.pdfCATALOG TB điện OPPLE 2023 CATALOGUE.pdf
CATALOG TB điện OPPLE 2023 CATALOGUE.pdf
 

BTL-CSDL2-streaming.pdf

  • 1. HỌC VIỆN NGÂN HÀNG KHOA LÝ HỆ THỐNG THÔNG TIN QUẢN LÝ BÀI TẬP LỚN: MÔN CƠ SỞ DỮ LIỆU 2 ĐỀ TÀI: HỆ THỐNG QUẢN LÝ LIVE STREAMING Giảng viên hướng dẫn: Nguyễn Thị Thu Trang Nhóm viên thực hiện: 13 Nhóm tín chỉ: 202IS12A01 Hà Nội, ngày 20 tháng 06 năm 2021
  • 2. Danh sách thành viên nhóm STT Họ và tên Mã sinh viên Lớp niên chế % đóng góp 1 Bùi Thu Hà 22A4040011 K22HTTTA 25% 2 Nguyễn Thị Lan Anh 22A4040099 K22HTTTB 25% 3 Nguyễn Quang Huy 22A4040018 K22HTTTA 25% 4 Chu Thúy Quỳnh 22A4040087 K22HTTTB 25%
  • 3. Mục lục I. Mô tả bài toán ..........................................................................................1 1. Phát biểu bài toán..................................................................................1 2. Mục đích bài toán .................................................................................1 3. Sơ đồ thực thể liên kết ..........................................................................2 II. Triển khai bài toán ...................................................................................4 1. Tạo cơ sở dữ liệu ..................................................................................4 1.1. Tablespace............................................................................................................. 4 1.2. Tạo bảng................................................................................................................. 5 1.3. Nhập dữ liệu ......................................................................................................... 7 1.4. Phân vùng dữ liệu............................................................................................. 12 2. Thực hiện yêu cầu truy vấn.................................................................12 3. Thực hiện yêu cầu nghiệp vụ..............................................................15 4. Thực hiện quản trị cơ sở dữ liệu.........................................................21 4.1. Tạo user................................................................................................................ 21 4.2. Sao lưu (backup)............................................................................................... 22 4.3. Phục hồi (recovery) ......................................................................................... 26 III. Kết luận...............................................................................................28 1. Ưu điểm ..............................................................................................28 2. Nhược điểm.........................................................................................28
  • 4. 1 I. Mô tả bài toán 1. Phát biểu bài toán Để có thể phát trực tiếp buổi chơi game hoặc nói chuyện, giao lưu với người xem thì streamer sẽ phải sử dụng các nền tảng livestream. Mỗi nền tảng sẽ có những ưu điểm và nhược điểm riêng, việc sử dụng nền tảng nào là do nhu cầu, ý muốn của từng người. Các nền tảng sẽ xây dựng website riêng và app trên điện thoại để tiện lợi hơn cho người dùng cũng như người xem livestream. Ở mỗi nền tảng, người dùng có thể đặt các tên tài khoản khác nhau với số lượng subcriber khác nhau. Để thu hút và tạo môi trường phát triển tốt hơn cho các streamer, mỗi nền tảng sẽ lựa chọn hợp tác với một số nhà phát hành game để có những ưu đãi bằng cách đảm bảo thực hiện các điều kiện của nhà phát hành game đưa ra. Nhà phát hành game có mã, tên và địa chỉ web riêng. Mỗi game do một nhà phát hành game phát hành độc quyền. Game có mã riêng, có tên, thể loại, dung lượng game và link tải. Mỗi streamer có thể chơi nhiều game và mỗi game cũng được nhiều streamer chơi. Donater sẽ đăng kí tài khoản và nạp tiền vào một cổng donate nhất định. Mỗi cổng donate đều có website và có tỉ lệ chiết khấu (từ số tiền donater ủng hộ) khác nhau. Donater có thể nhập số tiền và lời nhắn khi ủng hộ tiền cho streamer thông qua cổng donate. 2. Mục đích bài toán Khái niệm livestream được dịch ra tiếng Việt là truyền video trực tiếp. Trong đó, live là trực tiếp, còn stream là một trong những phương pháp giúp truyền tải các dữ liệu khi người xem video thông qua mạng internet. Livestream lần đầu tiên được sử dụng với tên gọi upstream vào năm 2007 dành cho binh lính Mỹ và dần phát triển mạnh mẽ trên nhiều lĩnh vực. Đặc biệt, năm 2020 đã đánh dấu mốc phát triển mới cho ngành công nghiệp game livestreaming. Dịch Covid-19 xuất hiện từ những tháng đầu tiên của năm 2020 và gây nên những ảnh hưởng đến toàn xã hội. Theo số liệu từ Statista (Cổng thông tin trực tuyến về thống kê của Đức), 49% người tham gia khảo sát dành nhiều thời gian trên
  • 5. 2 internet hơn, 36% người chơi game nhiều hơn, 69% người dùng tăng thời gian sáng tạo và theo dõi các nội dung streaming tại nhà. Ngoài những streamer kì cựu, năm 2020 và nửa đầu năm 2021 còn đón chào nhiều người nổi tiếng trên các lĩnh vực khác tham gia “ngành công nghiệp tỷ đô” này: ca sĩ Khởi My, rapper MCK, thủ môn Bùi Tấn Trường, bình luận viên Lê Khôi,… Trước ảnh hưởng kéo dài của dịch Covid-19, hầu hết các hoạt động kinh doanh đều được chuyển sang hình thức trực tuyến, đây cũng là lúc truyền thông - marketing online càng được chú trọng và yêu cầu tính hiệu quả cao. Một trong những nội dung giải trí trực tuyến thu hút được nhiều sự theo dõi của người dùng internet trong thời điểm cách ly là các nội dung gaming livestream. Điều đó đã đưa “nghề streamer” trở nên hot và phát triển nhanh hơn bao giờ hết. Chỉ một buổi livestream khoảng 4-5 tiếng có thể đem đến cho streamer số tiền lên tới hàng chục triệu đồng cùng với sự chú ý của nhiều nhãn hàng và có thể là những hợp đồng quảng cáo giá trị cao. Tiềm năng kinh tế lớn như vậy đòi hỏi “gaming creators” cần có ekip trợ giúp sắp xếp, sáng tạo, phát triển thêm nhiều nội dung nhằm thu hút nhiều nhất số lượng người xem, đem đến lợi ích kinh tế cho bản thân, tổ chức thậm chí là cho xã hội. Đó là công việc của công ty quản lý. Công ty quản lý sẽ gồm “gaming creators” - được coi như những “ngôi sao”, cùng với đội ngũ sáng tạo nội dung, sắp xếp lịch trình, quản lý thu nhập, phát triển cộng đồng, liên hệ đối tác,… Cơ sở dữ liệu này sẽ góp phần giúp công việc đó trở nên đơn giản hơn. 3. Sơ đồ thực thể liên kết
  • 6. 3
  • 7. 4 II. Triển khai bài toán 1. Tạo cơ sở dữ liệu 1.1. Tablespace a. Mục đích Quản lý tablespace trong Oracle đặc biệt quan trọng trong việc cấp vùng dữ liệu làm việc cho user. Với mỗi tablespace ta có thể tùy chỉnh chế độ online hoặc offline để thay đổi tính sẵn dùng của các dữ liệu trong database vì mỗi dữ liệu lại gắn với những yêu cầu, mục đích sử dụng, quản lí khác nhau. Hơn thế nữa, việc tạo thêm tablespace giúp ích rất lớn cho việc sao lưu (backup) và phục hồi (recovery) dữ liệu một cách hiệu quả nhất, năng suất cao nhất. Bởi tablespace có một điểm rất hữu ích đó là ta có thể chuyển các tablespace sang chế độ read-only (chỉ đọc) để hạn chế các thủ tục cần thiết khi sao lưu và phục hồi một phần lớn dữ liệu không bị thay đổi của database. Vì Oracle sẽ không thực hiện cập nhật các file nằm trong tablespace read-only. Từ các bảng được sử dụng trong đề tài và mục đích sử dụng mỗi bảng, ta chỉ cần tạo 2 tablespace là myspace1 và myspace2. Với tablespace myspace1 ta lưu trữ các dữ liệu ít bị thay đổi còn tablespace myspace2 ta lưu trữ các dữ liệu thường xuyên phải cập nhật, thay đổi như: subcriber, thời điểm chơi, thời điểm donate, số tiền donate, lời nhắn, số dư tài khoản,… Việc phân chia này được phục vụ cho việc nâng cao hiệu suất trong việc sao lưu và phục hồi dữ liệu theo từng phần. b. Tạo tablespac CREATE TABLESPACE myspace1 DATAFILE 'G:appFPTSHOPoradataorclTablespace01.dbf' SIZE 100M autoextend on next 100m maxsize 1024m extent management local;
  • 8. 5 1.2.Tạo bảng CREATE TABLE Streamer ( MASTREAMER NVARCHAR2(10)PRIMARY KEY NOT NULL, check (REGEXP_LIKE(MASTREAMER,'^STd{2,}$')), TENSTREAMER NVARCHAR2(50), GIOITINH NVARCHAR2(10), QUEQUAN NVARCHAR2(50), NGAYSINH DATE, SODIENTHOAI NVARCHAR2(12) CHECK (REGEXP_LIKE(SODIENTHOAI, '^0d{9}$|^0d{10}$')) ); CREATE TABLE NhaPhatHanhGame ( MANHAPHATHANH NVARCHAR2(10)PRIMARY KEY NOT NULL, TENNHAPHATHANH NVARCHAR2(50), DIACHIWEB NVARCHAR2(50)); CREATE TABLE NenTang ( WEBSITE NVARCHAR2(50) PRIMARY KEY NOT NULL, TENNENTANG NVARCHAR2(50), MOBILEAPP NVARCHAR2(50)); CREATE TABLE CongDonate ( WEBCONG NVARCHAR2(50) primary key NOT NULL, TENCONG NVARCHAR2(50), TILECHIETKHAU FLOAT, check(tilechietkhau >=0)); CREATE TABLE Donater ( MADONATER NVARCHAR2(10) PRIMARY KEY NOT NULL check (REGEXP_LIKE(MADONATER,'^DTd{2,}$')), WEBCONG NVARCHAR2 (50), TENTAIKHOAN NVARCHAR2(50), SODUTAIKHOAN number, Constraint fk_webcong foreign key (webcong) references Congdonate ); CREATE TABLESPACE myspace2 DATAFILE 'G:appFPTSHOPoradataorclTablespace02.dbf' SIZE 500M autoextend on next 500m maxsize 4028m extent management local;
  • 9. 6 CREATE TABLE Game ( MAGAME NVARCHAR2(10) PRIMARY KEY NOT NULL check (REGEXP_LIKE(MAGAME,'^Gd{2,}$')), MANHAPHATHANH NVARCHAR2(10) NOT NULL, TENGAME NVARCHAR2(50) NOT NULL, THELOAI NVARCHAR2(50) NOT NULL, LINKDOWNLOAD NVARCHAR2(100), DUNGLUONG NVARCHAR2(10), Constraint fk_manhaphathanh foreign key (manhaphathanh) references Nhaphathanhgame ); CREATE TABLE CHOI ( MASTREAMER NVARCHAR2(10) NOT NULL, MAGAME NVARCHAR2(10) NOT NULL, THOIDIEMBATDAU DATE, THOIDIEMKETTHUC DATE, check (THOIDIEMBATDAU < THOIDIEMKETTHUC), Constraint pk_Streamer_Game primary key (mastreamer, magame), Constraint fk_mastreamer_magame foreign key ( mastreamer) references Streamer, Constraint fk_magame_mastreamer foreign key (magame) references Game ); CREATE TABLE HOPTAC ( WEBSITE NVARCHAR2(50) NOT NULL, MANHAPHATHANH NVARCHAR2(10) NOT NULL, DIEUKIEN NVARCHAR2(200), UUDAI NVARCHAR2(200), Constraint pk_web_maNPH primary key (website,manhaphathanh), Constraint fk_web_maNPH foreign key (website) references Nentang, Constraint fk_maNPH_web foreign key (manhaphathanh) references Nhaphathanhgame ); CREATE TABLE Donate ( MASTREAMER NVARCHAR2(10) NOT NULL, WEBCONG NVARCHAR2(50) NOT NULL, SOTIEN number, THOIDIEMDONATE DATE, LOINHAN NVARCHAR2(200), Constraint pk_mastreamer_WebCong primary key (mastreamer,webcong), Constraint fk_webcong_mastreamer foreign key (webcong) references Congdonate, Constraint fk_streamer_webcong foreign key (mastreamer) references Streamer );
  • 10. 7 1.3. Nhập dữ liệu CREATE TABLE SuDung ( WEBSITE NVARCHAR2(50) NOT NULL, MASTREAMER NVARCHAR2(10) NOT NULL, TENTAIKHOAN NVARCHAR2(50) NOT NULL, SUBCRIBER number, Constraint pk_mastreamer_website primary key (mastreamer, website), Constraint fk_streamer_website foreign key (mastreamer) references Streamer, Constraint fk_webite_streamer foreign key (website) r references Nentang ); -----------Streamer------------- Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai) values ('ST01', 'Phung Thanh Do', 'Nam', 'Cao Bang', to_date('12/09/1989','dd/mm/yyyy'), ‘0965698119’); Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai) values ('ST02', 'Hoang Van Khoa', 'Nam', 'Hai Phong', to_date('23/06/1991','dd/mm/yyyy'), '0398549916'); Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai) values ('ST03', 'Dang Tien Hoang', 'Nam', 'Ha Noi', to_date('08/05/1990','dd/mm/yyyy'), '0968510396'); Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai) values ('ST04', 'Nghiem Anh Hieu', 'Nam', 'England', to_date('27/04/1989','dd/mm/yyyy'), '0976483772'); Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai) values ('ST05', 'Pham Thuy Trang', 'Nu', 'Ho Chi Minh', to_date('04/11/2002','dd/mm/yyyy'), '0356785654'); Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai) values ('ST06', 'Lam Dinh Khoa', 'Nam', 'Cao Lanh', to_date('24/05/1996','dd/mm/yyyy'), '0393244111'); Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai) values ('ST07', 'Dam Ngoc Linh', 'Nu', 'Ha Noi', to_date('08/06/1996','dd/mm/yyyy'), '0808061996'); Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai) values ('ST08', 'Tran Thai Linh', 'Nam', 'Ha Noi', to_date('16/06/1997','dd/mm/yyyy'), '0975356889'); Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai) values ('ST09', 'Nguyen Van Thuan', 'Nam', 'America', to_date('17/12/1995','dd/mm/yyyy'), '0923457854');
  • 11. 8 Insert into Streamer (mastreamer, tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai) values ('ST10', 'Tran Manh Quang', 'Nam', 'Ha Noi', to_date('13/11/1994','dd/mm/yyyy'), '0513111994'); -----------NhaPhatHanhGame--------- Insert into Nhaphathanhgame (manhaphathanh, tennhaphathanh, diachiweb) values ('VNG', 'Vinagame', 'vinagame.com'); Insert into Nhaphathanhgame (manhaphathanh, tennhaphathanh, diachiweb) values ('VTCG', 'VTC game', 'vtcgame.com'); Insert into Nhaphathanhgame (manhaphathanh, tennhaphathanh, diachiweb) values ('GRN', 'Garena Vietnam', 'garena.com'); -------------CongDonate-------- Insert into Congdonate (webcong, tencong, tilechietkhau) values ('Unghotoi.com', 'Ung ho toi', '15'); Insert into Congdonate (webcong, tencong, tilechietkhau) values ('Streamlabs.com', 'Streamlab', '10'); Insert into Congdonate (webcong, tencong, tilechietkhau) values ('Playerdou.com', 'Playerdou', '11.1'); ----------Donater------------- Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT01', 'Huyhara', '200000', 'Unghotoi.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT02', 'Chuchoa', '234567', 'Streamlabs.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT03', 'Lanhconyxin', '123987', 'Unghotoi.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT04', 'Bthahbthongdoc', '9876543', 'Playerdou.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT05', 'Miuxinh', '555555', 'Streamlabs.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT06', 'Chautinhbo', '357913', 'Playerdou.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT07', 'Khibg', '20202020', 'Streamlabs.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT08', 'Phungthailinh', '444444', 'Playerdou.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT09', 'Thailinhhuong', '979797', 'Playerdou.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT10', 'Thayonip', '9999991', 'Streamlabs.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT11', 'Tudu', '686868', 'Playerdou.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT12', 'Maydapnghean', '377337', 'Unghotoi.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT13', 'Khoimom', '787878', 'Playerdou.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT14', 'Toisung', '551102', 'Streamlabs.com'); Insert into Donater (madonater, tentaikhoan, sodutaikhoan, webcong) values ('DT15', 'Nhunhi', '2222222', 'Unghotoi.com'); ---------Game-------------- Insert into Game (magame, manhaphathanh, tengame, theloai, linkdownload, dungluong) values ('G01', 'GRN', 'League of legend', 'Chien thuat', 'lol.exe', '11.7GB'); Insert into Game (magame, manhaphathanh, tengame, theloai, linkdownload, dungluong) values ('G02', 'VNG', 'PUBG', 'Dong doi', 'pubg.exe', '15.03GB');
  • 12. 9 Insert into Game (magame, manhaphathanh, tengame, theloai, linkdownload, dungluong) values ('G03', 'VNG', 'CF', 'Tactic', 'cf.exe', '7.65GB'); Insert into Game (magame, manhaphathanh, tengame, theloai, linkdownload, dungluong) values ('G04', 'VTCG', 'Audition', 'Music', 'au.exe', '3.63GB'); Insert into Game (magame, manhaphathanh, tengame, theloai, linkdownload, dungluong) values ('G05', 'GRN', 'Fifa online', 'Sport','fifa.exe', '10.98GB'); ------------Nen Tang--------- Insert into Nentang (website, tennentang, mobileapp) values ('nimo.tv', 'Nimo', 'Nimo TV app'); Insert into Nentang (website, tennentang, mobileapp) values ('youtube.com', 'YouTube', 'YouTube'); --------------Choi------------ Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST01', 'G01', TO_DATE('07/09/2020 11:30:25','dd/mm/yyyy HH:MI:SS'), TO_DATE('08/09/2020 3:50:33','dd/mm/yyyy HH:MI:SS')); Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST01', 'G02', TO_DATE('12/09/2020 10:57:58','dd/mm/yyyy HH:MI:SS'), TO_DATE('13/09/2020 4:50:11','dd/mm/yyyy HH:MI:SS')); Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST06', 'G05', TO_DATE('10/09/2020 8:30:25','dd/mm/yyyy HH:MI:SS'), TO_DATE('10/09/2020 9:50:25','dd/mm/yyyy HH:MI:SS')); Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST07', 'G03', TO_DATE('11/09/2020 7:30:25','dd/mm/yyyy HH:MI:SS'), TO_DATE('11/09/2020 9:33:25','dd/mm/yyyy HH:MI:SS')); Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST04', 'G02', TO_DATE('09/09/2020 7:13:26','dd/mm/yyyy HH:MI:SS'), TO_DATE('09/09/2021 9:22:31','dd/mm/yyyy HH:MI:SS')); Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST02', 'G01', TO_DATE('13/09/2020 9:30:22','dd/mm/yyyy HH:MI:SS'), TO_DATE('13/09/2020 11:20:20','dd/mm/yyyy HH:MI:SS')); Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST01', 'G04', TO_DATE('10/09/2020 11:30:25','dd/mm/yyyy HH:MI:SS'), TO_DATE('11/09/2020 5:10:34','dd/mm/yyyy HH:MI:SS')); Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST08', 'G01', TO_DATE('09/09/2020 8:33:22','dd/mm/yyyy HH:MI:SS'), TO_DATE('09/09/2020 11:50:25','dd/mm/yyyy HH:MI:SS')); Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST03', 'G05', TO_DATE('12/09/2020 9:30:25','dd/mm/yyyy HH:MI:SS'), TO_DATE('12/09/2020 11:55:25','dd/mm/yyyy HH:MI:SS')); Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST01', 'G03', TO_DATE('11/09/2020 11:03:13','dd/mm/yyyy HH:MI:SS'), TO_DATE('12/09/2020 2:34:56','dd/mm/yyyy HH:MI:SS')); Insert into Choi (mastreamer, magame, thoidiembatdau, thoidiemketthuc) values ('ST05', 'G02', TO_DATE('07/09/2020 3:22:25','dd/mm/yyyy HH:MI:SS'), TO_DATE('07/09/2020 5:55:40','dd/mm/yyyy HH:MI:SS'));
  • 13. 10 ----------- SuDung---------- Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('nimo.tv', 'ST01', 'Mixigaming', 1486278); Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('nimo.tv', 'ST02', 'Pewpew', 456823); Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('nimo.tv', 'ST03', 'Viruss', 289654); Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('nimo.tv', 'ST04', 'Xeme', 678145); Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('youtube.com', 'ST05', 'Xoainon', 197356); Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('youtube.com', 'ST06', 'Tuitenbo', 1394568); Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('youtube.com', 'ST07', 'LinhNgocDam', 3567189); Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('youtube.com', 'ST08', 'Nhism', 789245); Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('youtube.com', 'ST09', 'Snake', 478123); Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('youtube.com', 'ST10', 'QNT', 570234); Insert into Sudung (website, mastreamer, tentaikhoan, subcriber) values ('youtube.com', 'ST01', 'Mixigaming', 4892454); ----------------HopTac----------- Insert into Hoptac (website, manhaphathanh, dieukien,uudai) values ('nimo.tv', 'VNG', 'Tang 3% tai khoan moi trong thang dau', 'Tang 20% gia tri nap game'); Insert into Hoptac (website, manhaphathanh, dieukien,uudai) values ('nimo.tv', 'GRN', '100+ live stream game moi ngay', 'Giam gia 10% gia tri do trong shop game (co cong don voi su kien game)'); Insert into Hoptac (website, manhaphathanh, dieukien,uudai) values ('nimo.tv', 'VTCG', '10000+ luot xem live stream game moi ngay', 'Mien phi 3 do bat ki trong shop game'); Insert into Hoptac (website, manhaphathanh, dieukien,uudai) values ('youtube.com', 'GRN', 'Tang 3% tai khoan moi trong thang dau', 'Giam gia 15% gia tri do trong shop game (co cong don voi su kien game)'); -----------Donate------------ Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST01', 'Playerdou.com', 101101, to_date('09/09/2020 10:50:25','dd/mm/yyyy HH:MI:SS'), 'Cac anh choi game gi the a'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST01', 'Unghotoi.com', 10000000, to_date('09/09/2020 11:30:25','dd/mm/yyyy HH:MI:SS'), 'Hom nao moi anh em qua quan toi nhe'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST01', 'Streamlabs.com', 300000, to_date('11/09/2020 5:30:25','dd/mm/yyyy HH:MI:SS'), 'Hom nay stream muon the ong:)))'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST02', 'Streamlabs.com', 100000, to_date('07/09/2020 10:01:42','dd/mm/yyyy HH:MI:SS'), 'Nghe noi Hai Phong nhieu giang ho dung khong anh?');
  • 14. 11 Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST02', 'Unghotoi.com', 8000, to_date('09/09/2020 8:32:21','dd/mm/yyyy HH:MI:SS'), 'Anh mo chi nhanh o Ha Noi diiii:((('); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST03', 'Unghotoi.com', 321456, to_date('10/09/2020 5:05:05','dd/mm/yyyy HH:MI:SS'), 'Bao gio thi anh dinh lay chi Ngan a =)))'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST04', 'Playerdou.com', 20000, to_date('13/09/2020 10:15:09','dd/mm/yyyy HH:MI:SS'), 'Anh Hieu gio noi tieng Viet khong soi roi:))'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST05', 'Unghotoi.com', 10000, to_date('12/09/2020 3:33:59','dd/mm/yyyy HH:MI:SS'), 'Trang xinh nhu kieu con lai y. Theeeee'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST06', 'Unghotoi.com', 8000, to_date('10/09/2020 7:30:22','dd/mm/yyyy HH:MI:SS'), 'Du ca the gioi co quay lung lai voi anh thi em mai ben canh anh, anh Nhism'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST06', 'Playerdou.com', 500000, to_date('10/09/2020 8:02:52','dd/mm/yyyy HH:MI:SS'), 'Donate mo hom nhe.hi'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST07', 'Streamlabs.com', 10000, to_date('09/09/2020 2:15:07','dd/mm/yyyy HH:MI:SS'), 'Anh chi cute zl luon a.hix'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST08', 'Unghotoi.com', 8000, to_date('11/09/2020 8:10:01','dd/mm/yyyy HH:MI:SS'), 'MVP Viet Nam day = ))))))'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST08', 'Streamlabs.com', 200000, to_date('11/09/2020 9:09:18','dd/mm/yyyy HH:MI:SS'), 'Top 1 donate 1 cu nha'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST09', 'Playerdou.com', 50000, to_date('07/09/2020 12:30:24','dd/mm/yyyy HH:MI:SS'), 'Anh Ben hay qua troiii'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST09', 'Unghotoi.com', 20000, to_date('09/09/2020 1:03:51','dd/mm/yyyy HH:MI:SS'), 'Dinh gia moi loai xe'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST10', 'Unghotoi.com', 50000, to_date('12/09/2020 12:05:19','dd/mm/yyyy HH:MI:SS'), 'Nhac banh cuon qua anh zai'); Insert into Donate (mastreamer, webcong, sotien, thoidiemdonate, loinhan) values ('ST10', 'Streamlabs.com', 8000, to_date('12/09/2020 12:10:25','dd/mm/yyyy HH:MI:SS'), 'So litttt');
  • 15. 12 1.4. Phân vùng dữ liệu 2. Thực hiện yêu cầu truy vấn Công ty cần thường xuyên thực hiện các truy vấn dữ liệu nhằm quản lý và đánh giá hiệu quả công việc của các setreamer thuộc công ty mình. 2.1. Danh sách tổng số tiền được donate của mỗi streamer 2.2. Top 5 streamer có tổng số tiền donate nhiều nhất select mastreamer from (select mastreamer,sum(sotien) from donate group by mastreamer order by sum(sotien) desc ) where rownum<=5; select mastreamer,sum(sotien) "Tong tien donate" from donate group by mastreamer; alter table Nentang move tablespace myspace1; alter table Hoptac move tablespace myspace1; alter table Nhaphathanhgame move tablespace myspace1; alter table Game move tablespace myspace1; alter table Streamer move tablespace myspace1; alter table Congdonate move tablespace myspace1; alter table Sudung move tablespace myspace2; alter table Choi move tablespace myspace2; alter table Donate move tablespace myspace2; alter table Donater move tablespace myspace2;
  • 16. 13 2.3. Top 3 streamer có lượt subcribe cao nhất 2.4. Đưa ra tên streamer trẻ nhất 2.5. Độ tuổi trung bình của các streamer nam select mastreamer from (select mastreamer,sum(subcriber) from sudung group by mastreamer order by sum(subcriber) desc ) where rownum<=3; select mastreamer,tenstreamer from Streamer where extract(year from ngaysinh)= (select min(extract( year from ngaysinh)) from streamer); select round(avg(extract( year from sysdate)-extract( year from ngaysinh))) as "Tuoi TB" from Streamer where gioitinh='Nam';
  • 17. 14 2.6. Số game đã phát hành của mỗi nhà phát hành 2.7. Sắp xếp số dư tài khoản của các donater giảm dần 2.8. Đưa ra cổng donate có tỉ lệ chiết khấu thấp nhất 2.9. Đưa ra thông tin người donate gần nhất select tentaikhoan, sodutaikhoan from donater order by sodutaikhoan desc; select manhaphathanh,count(magame) as sogame from Game group by manhaphathanh; select webcong from congdonate where tilechietkhau = (select min(tilechietkhau) from congdonate) select tenstreamer from (select tenstreamer from streamer join donate on streamer.mastreamer = donate.mastreamer order by thoidiemdonate desc ) where rownum<=1
  • 18. 15 2.10. Số tiền được donate nhiều nhất của mỗi cổng trong 1 lần 3. Thực hiện yêu cầu nghiệp vụ Các yêu cầu nghiệp vụ cũng thường xuyên được thực hiện trong trường hợp cần tìm kiếm thông tin, kết quả của từng đối tượng hoặc nhóm đối tượng cụ thể. 3.1. Đưa ra thông tin streamer chơi, biết mã game select webcong, max(sotien) from donate group by webcong; Set serveroutput on declare stm streamer%rowtype; ma_g game.magame% type; cursor mag_cursor is select streamer.mastreamer,tenstreamer,gioitinh,quequan,ngaysinh, sodienthoai from streamer join choi on streamer.mastreamer = choi.mastreamer where choi.magame = ma_g; dem number; begin ma_g := '&ma_g'; select count(magame) into dem from game where magame = ma_g; if(dem = 0) then dbms_output.put_line('ko co ma game '|| ma_g); else dbms_output.put_line('danh sach streamer choi game co ma '|| ma_g||':'); open mag_cursor; loop fetch mag_cursor into stm.mastreamer, stm.tenstreamer, stm.gioitinh,stm.quequan, stm.ngaysinh, stm.sodienthoai; exit when mag_cursor%notfound;
  • 19. 16 3.2. Đưa ra thông tin nhà phát hành, biết mã game dbms_output.put_line('ma streamer: '||stm.mastreamer|| ' ten streamer:'||stm.tenstreamer||' gioi tinh: '|| stm.gioitinh||'que quan: '|| stm.quequan||' ngay sinh: '|| stm.ngaysinh||' so dien thoai:'||stm.sodienthoai); end loop; end if; close mag_cursor; end; set serveroutput on create or replace function NPH (ma_g game.magame%type) return nvarchar2 as tenNPH nhaphathanhgame.tennhaphathanh%type; maNPH nhaphathanhgame.manhaphathanh%type; dem int; begin select count(magame) into dem from game where magame = ma_g; if(dem=0) then tenNPH:='Ma game khong hop le'; else select manhaphathanh into maNPH from game where magame=ma_g; select tennhaphathanh into tenNPH from nhaphathanhgame where manhaphathanh=maNPH; end if; return tenNPH; end; --chạy function declare ma game.magame%type; t nhaphathanhgame.tennhaphathanh%type; begin ma:='&ma'; t:=NPH(ma); dbms_output.put_line('Ten nha phat hanh la: '||t); end;
  • 20. 17 3.3. Đưa ra thông tin donater, biết website cổng donate. 3.4. Đưa ra tỉ lệ phần trăm giới tính được nhập set serveroutput on declare dnt donater%rowtype; wc donater.webcong% TYPE; cursor wc_cursor is select * from donater where webcong = wc; dem number; begin wc := '&wc'; select count(wc) into dem from congdonate where webcong = wc; if(dem = 0) then dbms_output.put_line('ko co web cong '|| WC); else open wc_cursor; loop fetch wc_cursor into dnt.madonater, dnt.webcong, dnt.tentaikhoan, dnt.sodutaikhoan ; exit when wc_cursor%notfound; dbms_output.put_line('ma donater: '|| dnt.madonater ||' web cong : '||wc||' ten tai khoan: '|| dnt.tentaikhoan || ' so du tai khoan: '||dnt.sodutaikhoan); end loop; end if; close wc_cursor; end; set serveroutput on create or replace procedure tilegioitinh( g_t streamer.gioitinh% type) dem number; tong number; phantram number; begin select count(mastreamer) into tong from streamer; select count(gioitinh) into dem from streamer where gioitinh = g_t; phantram := (dem/tong)*100; dbms_output.put_line('gioi tinh '||g_t||' chiem '||phantram||'%'); end; exce tilegioitinh(&g_t);
  • 21. 18 3.5. Đưa ra danh sách streamer sử dụng nền tảng, biết website nền tảng 3.6. Đưa ra thông tin streamer, biết quê quán set serveroutput on declare ws sudung.website% TYPE; ten_tk sudung.tentaikhoan% type; dem number; cursor ws_cursor is select tentaikhoan from sudung where website =ws; begin ws := '&ws'; select count(website) into dem from nentang where website = ws; if(dem = 0) then dbms_output.put_line('khong co website nay'); else dbms_output.put_line('danh sach cac streamer lam viec voi '||ws||':'); open ws_cursor ; loop fetch ws_cursor into ten_tk; exit when ws_cursor%notfound; dbms_output.put_line(ten_tk); end loop; end if; close ws_cursor; end; set serveroutput on declare stm streamer%rowtype; que_quan streamer.quequan%TYPE; cursor stm_cursor is select * from streamer where quequan = que_quan; begin que_quan := '&que_quan'; open stm_cursor; loop fetch stm_cursor into stm.mastreamer, stm.tenstreamer, stm.gioitinh,stm.quequan, stm.ngaysinh, stm.sodienthoai; exit when stm_cursor%notfound; dbms_output.put_line('ma streamer: '||stm.mastreamer||' ten streamer:'||stm.tenstreamer||' gioi tinh: '|| stm.gioitinh||' que quan: '|| stm.quequan||' ngay sinh: '|| stm.ngaysinh||' so dien thoai:'||stm.sodienthoai); end loop; close stm_cursor; end;
  • 22. 19 3.7. Đưa ra thông tin streamer, biết mã streamer đó 3.8. Thống kê thứ hạng những game mà streamer đã chơi nhiều, thứ hạng set serveroutput on declare ma streamer.mastreamer%type; ten streamer.tenstreamer%type; gt streamer.gioitinh%type; qq streamer.quequan%type; ns streamer.ngaysinh%type; sdt streamer.sodienthoai%type; kt int; begin ma:='&ma'; select count(mastreamer) into kt from streamer where mastreamer=ma; if(kt!=0) then select tenstreamer, gioitinh, quequan, ngaysinh, sodienthoai into ten,gt,qq,ns,sdt from streamer where mastreamer=ma; dbms_output.put_line('Thong tin streamer co ma '||ma||' Ten: '|| ten||', gioi tinh '||gt||', que quan '||qq||', ngay sinh '||ns||', so dien thoai '||sdt); else dbms_output.put_line('Ma streamer khong hop le'); end if; end; set serveroutput on declare n int; begin n:=&n; dbms_output.put_line('Top '||n||' game duoc nhieu nguoi choi la: '); for numtb in (select magame from (select magame, count(mastreamer) from game join choi using(magame) group by magame order by count(mastreamer) desc) where rownum<=n) loop dbms_output.put_line(numtb.magame||' '); end loop; end;
  • 23. 20 3.9. Đưa ra số tiền các lần được donate của streamer, biết mã streamer 3.10. Đưa ra số donater đã nạp tiền, biết website cổng donate set SERVEROUTPUT ON declare ma_streamer streamer.mastreamer%type; tien donate.sotien%type; cursor cur_str is select b.sotien from streamer a inner join donate b on a.mastreamer=b.mastreamer where a.mastreamer=ma_streamer; solan int:=1; begin ma_streamer:='&ma_streamer'; dbms_output.put_line('Mastreamer: '||ma_streamer); open cur_str; loop fetch cur_str into tien; exit when cur_str%notfound; dbms_output.put_line(' lan '||solan||' duoc Donate '||tien); solan:=solan+1; end loop; close cur_str; end; set SERVEROUTPUT ON create or replace procedure tongluotnap (web donater.webcong%type) as soluong number; dem int; begin select count(webcong) into dem from donater where webcong = web; if(dem=0) then dbms_output.put_line ('Web khong hop le'); else select count(madonater) into soluong from donater where webcong=web; dbms_output.put_line('So donater da dung web cong '||web||' la: ' ||soluong); end if; end; exec tongluotnap(&web);
  • 24. 21 4. Thực hiện quản trị cơ sở dữ liệu 4.1. Tạo user Hệ thống được sử dụng bởi: - Người quản lý: có toàn quyền trên cơ sở dữ liệu. Thực hiện các công việc như backup CSDL, giải quyết sự cố nếu có vấn đề xảy ra với CSDL. - Streamer và người xem: chỉ có quyền xem thông tin. Create USER managerCreatory IDENTIFIED BY Creatory; Grant CONNECT,RESOURCE,DBA to managerCreatory; Alter user managerCreatory quota unlimited on myspace1; Alter user managerCreatory quota unlimited on myspace2; ALTER USER managerCreatory DEFAULT TABLESPACE users; ALTER USER managerCreatory TEMPORARY TABLESPACE temp; Grant unlimited tablespace to managercreatory; Create user viewer identified by 123; Alter user viewer quota unlimited on myspace1; Alter user viewer quota unlimited on myspace2; Grant create session to viewer; Grant create view to viewer; Grant unlimited tablespace to viewer; GRANT SELECT ANY TABLE TO viewer; ALTER USER viewer DEFAULT TABLESPACE users; ALTER USER viewer TEMPORARY TABLESPACE temp;
  • 25. 22 4.2. Sao lưu (backup) Backup dữ liệu định kì vào 12h chủ nhật hàng tuần a. Phương án backup - Có hai phương án back up: kịch bản back up do DBA tự định nghĩa và Recovery Manager (RMAN). Với kịch bản backup do DBA tự định nghĩa thì người quản trị phải tự viết lệnh để thực hiện backup. Việc này phức tạp và tốn thời gian hơn việc sử dụng RMAN nên với đề tài này, nhóm quyết định dùng RMAN để backup. - Được cài đặt cùng với cơ sở dữ liệu, RMAN là một ứng dụng client cơ sở dữ liệu Oracle thực hiện các nhiệm vụ sao lưu và phục hồi trên cơ sở dữ liệu của bạn và tự động hóa việc quản trị chiến lược sao lưu. Nó đơn giản hóa đáng kể việc sao lưu, khôi phục và phục hồi cơ sở dữ liệu. - Các đặc điểm nổi bật của RMAN: + Có các hàm để chạy lệnh backup. + Có API để tương thích với các phần mềm backup. + Có thể backup data file, control file, archived log, parameter file. + Có thể backup dữ liệu ra đĩa hoặc băng từ. + Cung cấp cấp báo cáo chi tiết về các hoạt động sao lưu. + Chỉ RMAN cung cấp khả năng thực hiện sao lưu mã hóa. Ở đề tài này, nhóm sẽ sử dụng RMAN thông qua EM. b. Chiến lược backup - Gồm: + Backup toàn bộ database Grant select on managerCreatory.game to viewer; Grant select on managerCreatory.donate to viewer; Grant select on managerCreatory.donater to viewer; Grant select on managerCreatory.nhaphathanhgame to viewer; Grant select on managerCreatory.streamer to viewer; Grant select on managerCreatory.congdonate to viewer; Grant select on managerCreatory.hoptac to viewer; Grant select on managerCreatory.sudung to viewer;
  • 26. 23 + Backup một phần - Nhóm lựa chọn backup toàn bộ database để giúp ích cho việc phục hồi sau này. c. Chế độ backup - Gồm: + Cold/Consistent (nguội): tiến hành khi database đóng + Hot/Inconsistent (nóng): tiến hành khi database mở - Nhóm sử dụng hot backup (online backup) vì mỗi khi có sự thay đổi dữ liệu sẽ được ghi vào Redo log files. Vì vậy, khi phục hồi sẽ không bị mất nhiều dữ liệu. Để sử dụng online backup, cần phải đảm bảo cơ sở dữ liệu đang ở chế độ Archive log mode. Khi đó, ta có thể khôi phục tập tin hoặc khôi phục lại bản sao lưu và áp dụng các Archive log mode. d. Loại backup - Incremental backup (sao lưu gia tăng): là backup những gì thay đổi so với lần incremental backup gần nhất - Nhóm quyết định chọn incremental backup vì: + Thời gian backup nhanh + Dung lượng backup ít hơn e. Các bước tiến hành backup (1) Bật chế độ ARCHIVELOG để có thể thực hiện Online backup.
  • 27. 24 (2) Backup toàn bộ CSDL (Whole Database). (3) Chọn Schedule Customized Backup để lên lịch sao lưu. (4) Setting
  • 28. 25 (5) Schedule (6) Review Chọn Submit Job để hoàn tất.
  • 29. 26 4.3. Phục hồi (recovery) - Trong quá trình sử dụng, database có thể xuất hiện những lỗi như sau: + Statement failure + User process failure + Network failure + User or application error + Instance failure + Media failure - Những lỗi trên có thể xảy ra khi mất control file, data file hoặc một nhóm redo log,… Ở đây, nhóm đưa ra cách khắc phục khi bị mất control file và data file. a. Khắc phục khi mất control file (khôi phục từ AutoBackup) (1) Tắt database (nếu đang mở) RMAN → shutdown immediate; RMAN → startup nomount; (2) Khôi phục lại control file bằng cách copy control file đã backup RMAN → restore controlfile from autobackup; RMAN → alter database mount; RMAN → recover database; (3) Khởi động lại database Alter database open resetlogs; b. Khắc phục khi mất data file - TH1: Database ở chế độ NOARCHIVELOG (bất kì data file nào bị mất) (1) Tắt database (nếu đang mở)
  • 30. 27 RMAN → shutdown immediate; RMAN → startup nomount; (2) Phục hồi lại toàn bộ database, bao gồm: data file, control file RMAN → restore datafile ‘corrupted_data_file_name_path’1 ; RMAN → restore controlfile from autobackup; RMAN → recover database; (3) Khởi động lại database Alter database open resetlogs; - TH2: Database ở chế độ ARCHIVELOG + Nếu không thuộc tablespace system&undo + Nếu thuộc tablespace system&undo (1) Tắt database theo chế độ SHUTDOWN ABORT (2) Mount database Startup mount; (3) Phục hồi data flie bị mất (4) Mở lại database 1 Đường chỉ dẫn đến data file bị hỏng
  • 31. 28 III. Kết luận 1. Ưu điểm Bài làm của nhóm về cơ bản đã xây dựng được cơ sở dữ liệu phục vụ cho công việc quản lý trong lĩnh vực game livestreaming. - Thông tin được lưu trữ có hệ thống: liên kết giữa các bảng được đơn giản hóa và tối ưu, giúp công việc tạo lập, lưu trữ, truy xuất được thực hiện chính xác, nhanh chóng. - Đảm bảo an toàn dữ liệu: dữ liệu được phân vùng cụ thể, cấp quyền và nhóm quyền cho các đối tượng người dùng khác nhau. Ngoài ra, nhóm đã có phương án sao lưu, phục hồi dữ liệu cụ thể, đảm bảo dữ liệu được lưu trữ trong thời gian dài. - Dữ liệu có tính thực tế: các dữ liệu được nêu trong bài là kết quả của quá trình tìm hiểu, chắt lọc với tính chính xác cao của nhóm. Các truy vấn và thao tác nghiệp vụ cũng là những thông số, thông tin được đa số người xem quan tâm. 2. Nhược điểm Ngoài những ưu điểm đạt được, bài làm vẫn còn nhiều thiếu sót do đây là lần đầu nhóm cùng nhau tự thực hiện xây dựng một cơ sở dữ liệu về lĩnh vực khá mới, tài liệu tham khảo còn hạn chế. - Lĩnh vực game livestreaming còn nhiều mảng nội dung có thể khai thác, tìm hiểu (lượt xem, tương tác, quảng cáo,…). Nhưng trong khuôn khổ bài tập lớn, nhóm chưa thể truyền tải đầy đủ đến cô cũng như các bạn về lĩnh vực đầy tiềm năng này. - Chưa đưa ra được cách phục hồi các trường hợp phức tạp hơn.