- Сначала создаём пользователя
STUDENT_DB
, даём ему нужные права - Подключаемся к БД под
STUDENT_DB
, создаём нужные таблицы - Кладём
csv
иctl
файлы в контейнер. Я для простоты запихнул их в каталог, который прокидывал в контейнер в предыдущей домашке - Запускаем команды
docker exec
, в табличках должны появиться данные
Created
November 4, 2022 22:25
-
-
Save m-sedl/03066b5cb589232cd29d3b69193532c6 to your computer and use it in GitHub Desktop.
dbsm hw 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- run from DEVELOPER user | |
drop user STUDENT_DB; | |
create user STUDENT_DB identified by STUDENT_DB; | |
grant connect, resource to STUDENT_DB; | |
ALTER USER STUDENT_DB quota unlimited on USERS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOAD DATA | |
CHARACTERSET UTF8 | |
INFILE 'FACULTIES.CSV' | |
BADFILE 'FACULTIES.bad' | |
DISCARDFILE 'FACULTIES.dsc' | |
TRUNCATE | |
INTO TABLE STUDENT_DB.faculty | |
FIELDS TERMINATED BY ';' | |
TRAILING NULLCOLS | |
( | |
faculty_letter, | |
faculty_name_ru, | |
faculty_name_en | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker exec -ti testdb sqlldr STUDENT_DB/STUDENT_DB@//localhost:1521/XEPDB1 control=/opt/oracle/oradata/loads/FACULTIES.ctl data=/opt/oracle/oradata/loads/FACULTIES.CSV | |
docker exec -ti testdb sqlldr STUDENT_DB/STUDENT_DB@//localhost:1521/XEPDB1 control=/opt/oracle/oradata/loads/STUDENTS.ctl data=/opt/oracle/oradata/loads/STUDENTS.CSV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- run from STUDENT_DB user | |
create table faculty | |
(faculty_letter VARCHAR2(1) PRIMARY KEY, faculty_name_ru VARCHAR2(200), faculty_name_en VARCHAR2(200)); | |
create table student | |
(student_id number PRIMARY KEY, group_code VARCHAR2(50)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OPTIONS (SKIP=1) | |
LOAD DATA | |
CHARACTERSET UTF8 | |
INFILE 'STUDNETS.CSV' | |
BADFILE 'STUDNETS.bad' | |
DISCARDFILE 'STUDNETS.dsc' | |
TRUNCATE | |
INTO TABLE STUDENT_DB.student | |
FIELDS TERMINATED BY ';' | |
TRAILING NULLCOLS | |
( | |
group_code, | |
student_id | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment