标签:mit cer header second rom def 表设计 current display
先设计E-R图,在设计各个表
open 192.168.213.115
用户名
密码
cd /你需要的路径
ls
put 文件名
delete from m_counter_party;
备份
pg_dump --host d2-postgres-common-master.sbisec.int --port 5432 --username "ceres" --no-password --data-only --format custom --file "dev03pm-20190724-autobefore.backup" --schema=ceres --exclude-table=m_user_attr "dpcers03"
恢复
pg_restore --host d2-postgres-common-master.sbisec.int --port 5432 --username "ceres" --dbname "dpcers02" --no-password --data-only --schema ceres --verbose "dev03pm-20190724-autobefore.backup"
注意:上述语句在哪儿执行,生成文件在哪儿
# 单表备份
psql -q -h ‘d2-postgres-common-master.sbisec.int‘ -d dpdmtr02 -U demeter -c "\COPY (SELECT * FROM demeter.m_business_date) TO ‘/home/peng.chen/demeter.m_business_date.csv‘ WITH (FORMAT CSV, HEADER true, DELIMITER ‘,‘, NULL ‘‘)"
确认备份成功后,删除这个表,delete from 表名
恢复数据
psql -q -h ‘d2-postgres-common-master.sbisec.int‘ -d dpdmtr02 -U demeter -c "\COPY demeter.m_business_date FROM ‘/home/alice/demeter.m_business_date.csv‘ WITH (FORMAT CSV, HEADER true, DELIMITER ‘,‘, NULL ‘‘)"
# 执行DDL设定修改
set default_tablespace = ceres_data_03 如果要执行dpcers03的库
set default_tablespace = ceres_data_02 如果要执行dpcers02的库
# 如何锁定某个表
先执行
begin work;
lock table t_trading_detail in SHARE MODE;
前执行前两句,后执行最后一句,就解除了
commit work;
但是我在A5上面尝试没好使
方法2:直接把表锁死,除了个用户都没法使用
update m_user_attr set delete_sts = ‘1‘ Userを論理削除すれば、他の人がLoginできない。
# DDL
CREATE TABLE CERES.T_PTH_DETAIL ( -- PTH明細テーブル
BASE_DT CHAR(8) NOT NULL, -- 基準日
PTH_NO serial NOT NULL, -- PTH番号
PTH_NO_SUB NUMERIC(3,0) NOT NULL, -- PTH番号(補助)
SEC_CD CHAR(5) NOT NULL, -- 銘柄コード
CONSTRAINT T_PTH_DETAIL_pk PRIMARY KEY (BASE_DT, PTH_NO, PTH_NO_SUB));
COMMENT ON TABLE CERES.T_PTH_DETAIL IS ‘PTH明細テーブル‘;
COMMENT ON COLUMN CERES.T_PTH_DETAIL.BASE_DT IS ‘基準日‘;
# DML
insert into ceres.m_parameters(primary_cd,secondary_cd,type,display_seq,"class",name,"value",format,max,min,"decimal",max_length,description,delete_flg,create_user,create_dt,update_user,update_dt) values (‘P270‘,‘0012‘,‘2‘,160,‘JSF‘,‘Interest rate‘,‘0.6‘,‘percent‘,100,0,3,6,‘Interest rate‘,‘0‘,‘SBI BITS‘,CURRENT_TIMESTAMP,‘SBI BITS‘,CURRENT_TIMESTAMP);
UPDATE t_batch_process_result SET display_word1 = ‘-‘ WHERE process_id = ‘CR_CR04_0005‘;
标签:mit cer header second rom def 表设计 current display
原文地址:https://www.cnblogs.com/Alice1005/p/12538505.html