生产环境的DB规范
數據庫創建表操作規范注意事項 1、ucr_shop? 所有表建這個用戶。建表的表空間為TBS_DAT.主鍵,外鍵以及索引等使表空間為TBS_IDX。如下建表的例子 -- Create table createtable UCR_SHOP.TEST_LINDW ( ORG_ID_TESTNUMBER(8)notnull ) tablespace TBS_DAT pctfree10 initrans1 maxtrans255 storage ( initial256K next1M minextents1 maxextentsunlimited pctincrease0 ); 2)需要將新建的表相關權限授予uop_shop用戶,參考如下語句: grantinsert,delete,select,updateon? UCR_SHOP.tets_tablename to uop_shop; 3)創建表對應同義詞,參考如下語句: create public synonym test_tablename for UCR_SHOP.test_tablename; 注意:如果是建表,則第一步、第二步、第三步必須有,建議在建表完成之后就把授權、建同義詞的語句放在后面,如以杰哥的建表SQL為例: -- Create table create table UCR_SHOP.ECPS_SHUA_COUPONS_GROUP ( COUPONS_GROUP_ID????????? VARCHAR2(32) not null, COUPONS_GROUP_NAME??????? VARCHAR2(256), COUPONS_GROUP_STYLE?????? VARCHAR2(16), COUPONS_GROUP_PROBABILITY INTEGER, COUPONS_GROUP_DESC??????? VARCHAR2(1024) ) tablespace TBS_DAT pctfree 10 initrans 1 maxtrans 255 storage ( initial 10M next 10M minextents 1 maxextents unlimited pctincrease 0 ); -- Add comments to the table comment on table UCR_SHOP.ECPS_SHUA_COUPONS_GROUP is '卡劵大類'; -- Add comments to the columns comment on column UCR_SHOP.ECPS_SHUA_COUPONS_GROUP.COUPONS_GROUP_ID is '卡券大類ID'; comment on column UCR_SHOP.ECPS_SHUA_COUPONS_GROUP.COUPONS_GROUP_NAME is '卡券大類名稱'; comment on column UCR_SHOP.ECPS_SHUA_COUPONS_GROUP.COUPONS_GROUP_STYLE is '卡券展示'; comment on column UCR_SHOP.ECPS_SHUA_COUPONS_GROUP.COUPONS_GROUP_PROBABILITY is '中獎概率'; comment on column UCR_SHOP.ECPS_SHUA_COUPONS_GROUP.COUPONS_GROUP_DESC is '描述'; -- Create/Recreate primary, unique and foreign key constraints主鍵 alter table UCR_SHOP.ECPS_SHUA_COUPONS_GROUP add constraint PK_ECPS_SHUA_COUPONS_GROUP primary key (COUPONS_GROUP_ID) using index tablespace TBS_IDX pctfree 10 initrans 2 maxtrans 255 storage ( initial 10M next 10M minextents 1 maxextents unlimited pctincrease 0 ); ------權限授予uop_shop用戶 grant insert,delete,select,update on UCR_SHOP.ECPS_SHUA_COUPONS_GROUP to uop_shop; ------創建表對應同義詞 create public synonym ECPS_SHUA_COUPONS_GROUP for UCR_SHOP.ECPS_SHUA_COUPONS_GROUP; 4)創建序列,用UOP_SHOP用戶,參考如下語句: CREATE SEQUENCE UOP_SHOP.test_tablename minvalue 1 maxvalue 999999999999999999 start with 1 increment by 1 cache 20; 5)創建索引,用UCR_SHOP用戶,參考如下語句: create INDEX_NAME index UCR_SHOP.test_tablename(PRIZE_VALID_END) tablespace TBS_IDX pctfree 10 initrans 2 maxtrans 255 storage ( initial 10M next 10M minextents 1 maxextents unlimited pctincrease 0 ); 6)insertinto、update用ucr_shop用戶,參考如下語句: insert into ucr_shop.test_tablename (PAYCHNNL, INNER_MER,?? INTERFACETYPE, OFFLINEFLAG, REF_ID) values ('WEIXINPAY', '888073157340006', 'app', '1', '4'); update ucr_shop.test_tablename set ROYALTY = '1' ,PAY_PARTNERID =? '888073157340006'; 7)添加主鍵用UCR_SHOP用戶,參考如下語句: alter table UCR_SHOP.test_tablename add constraint TF_R_HOTSEARCH_ID primary key (HOTSEARCH_ID) using index tablespace TBS_IDX pctfree 10 initrans 2 maxtrans 255 storage ( initial 10M next 10M minextents 1 maxextents unlimited pctincrease 0 ); 8)提交的DB變更腳本名稱一律采用“需求名+姓名.txt/sql”的形式發送,如:shua-優化周杰.sql 數據庫創建表操作規范注意事項 1、ucr_shop? 所有表建這個用戶。建表的表空間為TBS_DAT.主鍵,外鍵以及索引等使表空間為TBS_IDX。如下建表的例子 -- Create table createtable UCR_SHOP.TEST_LINDW ( ORG_ID_TESTNUMBER(8)notnull ) tablespace TBS_DAT pctfree10 initrans1 maxtrans255 storage ( initial256K next1M minextents1 maxextentsunlimited pctincrease0 ); 2)需要將新建的表相關權限授予uop_shop用戶,參考如下語句: grantinsert,delete,select,updateon? UCR_SHOP.tets_tablename to uop_shop; 3)創建表對應同義詞,參考如下語句: create public synonym test_tablename for UCR_SHOP.test_tablename; 注意:如果是建表,則第一步、第二步、第三步必須有,建議在建表完成之后就把授權、建同義詞的語句放在后面,如以杰哥的建表SQL為例: -- Create table create table UCR_SHOP.ECPS_SHUA_COUPONS_GROUP ( COUPONS_GROUP_ID????????? VARCHAR2(32) not null, COUPONS_GROUP_NAME??????? VARCHAR2(256), COUPONS_GROUP_STYLE?????? VARCHAR2(16), COUPONS_GROUP_PROBABILITY INTEGER, COUPONS_GROUP_DESC??????? VARCHAR2(1024) ) tablespace TBS_DAT pctfree 10 initrans 1 maxtrans 255 storage ( initial 10M next 10M minextents 1 maxextents unlimited pctincrease 0 ); -- Add comments to the table comment on table UCR_SHOP.ECPS_SHUA_COUPONS_GROUP is '卡劵大類'; -- Add comments to the columns comment on column UCR_SHOP.ECPS_SHUA_COUPONS_GROUP.COUPONS_GROUP_ID is '卡券大類ID'; comment on column UCR_SHOP.ECPS_SHUA_COUPONS_GROUP.COUPONS_GROUP_NAME is '卡券大類名稱'; comment on column UCR_SHOP.ECPS_SHUA_COUPONS_GROUP.COUPONS_GROUP_STYLE is '卡券展示'; comment on column UCR_SHOP.ECPS_SHUA_COUPONS_GROUP.COUPONS_GROUP_PROBABILITY is '中獎概率'; comment on column UCR_SHOP.ECPS_SHUA_COUPONS_GROUP.COUPONS_GROUP_DESC is '描述'; -- Create/Recreate primary, unique and foreign key constraints主鍵 alter table UCR_SHOP.ECPS_SHUA_COUPONS_GROUP add constraint PK_ECPS_SHUA_COUPONS_GROUP primary key (COUPONS_GROUP_ID) using index tablespace TBS_IDX pctfree 10 initrans 2 maxtrans 255 storage ( initial 10M next 10M minextents 1 maxextents unlimited pctincrease 0 ); ------權限授予uop_shop用戶 grant insert,delete,select,update on UCR_SHOP.ECPS_SHUA_COUPONS_GROUP to uop_shop; ------創建表對應同義詞 create public synonym ECPS_SHUA_COUPONS_GROUP for UCR_SHOP.ECPS_SHUA_COUPONS_GROUP; 4)創建序列,用UOP_SHOP用戶,參考如下語句: CREATE SEQUENCE UOP_SHOP.test_tablename minvalue 1 maxvalue 999999999999999999 start with 1 increment by 1 cache 20; 5)創建索引,用UCR_SHOP用戶,參考如下語句: create INDEX_NAME index UCR_SHOP.test_tablename(PRIZE_VALID_END) tablespace TBS_IDX pctfree 10 initrans 2 maxtrans 255 storage ( initial 10M next 10M minextents 1 maxextents unlimited pctincrease 0 ); 6)insertinto、update用ucr_shop用戶,參考如下語句: insert into ucr_shop.test_tablename (PAYCHNNL, INNER_MER,?? INTERFACETYPE, OFFLINEFLAG, REF_ID) values ('WEIXINPAY', '888073157340006', 'app', '1', '4'); update ucr_shop.test_tablename set ROYALTY = '1' ,PAY_PARTNERID =? '888073157340006'; 7)添加主鍵用UCR_SHOP用戶,參考如下語句: alter table UCR_SHOP.test_tablename add constraint TF_R_HOTSEARCH_ID primary key (HOTSEARCH_ID) using index tablespace TBS_IDX pctfree 10 initrans 2 maxtrans 255 storage ( initial 10M next 10M minextents 1 maxextents unlimited pctincrease 0 ); 8)提交的DB變更腳本名稱一律采用“需求名+姓名.txt/sql”的形式發送,如:shua-優化周杰.sql
轉載于:https://www.cnblogs.com/kekesang/p/7827351.html
總結
- 上一篇: vs下使用qt设置应用程序的图标
- 下一篇: Eclipse出现Class Not F