日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

生产环境的DB规范

發布時間:2025/3/15 编程问答 15 豆豆
生活随笔 收集整理的這篇文章主要介紹了 生产环境的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

總結

以上是生活随笔為你收集整理的生产环境的DB规范的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。