Kód: Vybrat vše
# http://www.postgresql.org/docs/9.1/static/datatype-numeric.html
# http://www.postgresql.org/docs/9.1/static/datatype-character.html
# http://learningviacode.blogspot.cz/2014/04/creating-database-in-oracle-and-in.html
su -
aptitude update
aptitude full-upgrade
aptitude install postgresql
# listen_addresses = 'localhost' -> listen_addresses = '*'
vim /etc/postgresql/8.4/main/postgresql.conf
vim /etc/postgresql/8.4/main/pg_hba.conf
# host salesapp sales 10.3.45.130/32 md5
su - postgres
createuser -P sales # iaKnikIm5 n/n/n
createdb -O sales -E UTF8 salesapp
exit
psql -h 127.0.0.1 -d salesapp -U sales # OK, ctrl+d
aptitude install enca recode
cd /home/dba/Downloads
enca -L czech s_data1.sql
enca -L czech s_data2.sql
enca -L czech s_data3.sql
enca -L czech -x utf8 s_data*.sql
# v souboru s_def.sql je treba nahradit
#NUMBER za NUMERIC
#VARCHAR2 za CHARACTER VARYING
psql -h 127.0.0.1 -d salesapp -U sales -f s_def.sql 2> errdef #OK (pouze NOTICES) http://stackoverflow.com/questions/19738385/what-do-implicit-sequence-and-implicit-index-mean-in-postgres
psql -h 127.0.0.1 -d salesapp -U sales -f s_data1.sql 2> err1 #OK
psql -h 127.0.0.1 -d salesapp -U sales -f s_data2.sql 2> err2 #nejake chyby kvuli mezeram
psql -h 127.0.0.1 -d salesapp -U sales -f s_data3.sql 2> err3 #nejake chyby
psql -h 127.0.0.1 -d salesapp -U sales -f fin.sql 2> errfin # OK
exit
Kód: Vybrat vše
$ cat err*
psql:s_def.sql:30: NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "obor_pk" for table "obor"
psql:s_def.sql:53: NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "osoba_pk" for table "osoba"
psql:s_def.sql:82: NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "pracuje__idx" for table "pracuje"
psql:s_data2.sql:2669: ERROR: value too long for type character varying(8)
psql:s_data2.sql:2672: ERROR: value too long for type character varying(8)
psql:s_data3.sql:4658: ERROR: duplicate key value violates unique constraint "pracuje__idxx"
psql:s_data3.sql:5777: ERROR: duplicate key value violates unique constraint "pracuje__idxx"
psql:s_data3.sql:7391: ERROR: duplicate key value violates unique constraint "pracuje__idxx"
psql:s_data3.sql:13448: ERROR: duplicate key value violates unique constraint "pracuje__idxx"
psql:s_data3.sql:14171: ERROR: duplicate key value violates unique constraint "pracuje__idxx"
psql:s_data3.sql:14456: ERROR: duplicate key value violates unique constraint "pracuje__idxx"