当前位置:网站首页>Oracle database and table
Oracle database and table
2022-06-22 16:33:00 【thoughtCodes】
oracle Sub database and sub table
Survive by day and develop by night.
talk is cheap, show me the code,make a better result.
Catalog
summary
oracle How to divide databases and tables ?
demand :
1. introduce POM
2. yaml To configure
3. DDL
4. Prepare the test object
5. test
Design thinking
Analysis of implementation ideas
1. introduce POM
<dependency>
<groupId>io.shardingsphere</groupId>
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
<version>${sharding.jdbc.version}</version>
</dependency>
2.yaml To configure
sharding:
jdbc:
datasource:
names: ds0
# data source ds0
ds0:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@localhost:1521:xe
username: ******
password: ******
config:
sharding:
props:
sql.show: true
tables:
t_user: #t_user surface
key-generator-column-name: id # Primary key
actual-data-nodes: ds0.t_userKaTeX parse error: Expected 'EOF', got '#' at position 11: {0..1} #̲ Data nodes , Uniform distribution …{task_id % 2} # Assign by modulo
3. Preparation form DDL
2.3 Preparation form DDL
create table T_ADDRESS
(
ID NUMBER(20) not null
constraint T_ADDRESS_PK
primary key,
NAME VARCHAR2(64),
ADDR VARCHAR2(32)
)
/
comment on column T_ADDRESS.ID is ‘ Primary key ’
/
comment on column T_ADDRESS.NAME is ‘ name ’
/
comment on column T_ADDRESS.ADDR is ‘ Address ’
/
create table T_USER0
(
ID NUMBER(20) not null
constraint TABLE1_PK
primary key,
NAME VARCHAR2(64),
TASK_ID NUMBER(12),
CALL_MONTH VARCHAR2(20)
)
/
comment on column T_USER0.ID is ‘ Primary key ’
/
comment on column T_USER0.NAME is ‘ name ’
/
comment on column T_USER0.TASK_ID is ‘ Mission id’
/
comment on column T_USER0.CALL_MONTH is ‘ Call month ’
/
create table T_USER1
(
ID NUMBER(20) not null
constraint T_USER1_PK
primary key,
NAME VARCHAR2(64),
TASK_ID NUMBER(12),
CALL_MONTH VARCHAR2(20)
)
/
comment on column T_USER1.ID is ‘ Primary key ’
/
comment on column T_USER1.NAME is ‘ name ’
/
comment on column T_USER1.TASK_ID is ‘ Mission id’
/
comment on column T_USER1.CALL_MONTH is ‘ Call month ’
/
4. Prepare the test object
Test objects regardless of table :
@Test
public void save() {
for (int i = 0; i < 10; i++) {
Address address = new Address();
Long id = i + 1L;
address.setId(id);
address.setName(“name_” + i);
address.setAddr(“addr_” + i);
addressMapper.save(address);
}
}
5. Sub table test object
@Test
public void testSave() {
for (int i = 0; i < 10; i++) {
User user = new User();
Long id =i+1L;
user.setId(id);
user.setName(“test” + i);
user.setCallMonth(“201907”);
user.setTaskId(2L);
userMapper.save(user);
}
}
Expand to achieve
Reference here :github: Simply implement the above process :
Entry level implementation :
: Partial source code implementation .
: The source code to achieve
Performance parameter test :
nothing
References and recommended readings
Welcome to , Dear brother , If it helps you , A little praise and a little attention !~
边栏推荐
- User exit and customer exit in SAP ABAP -015
- Solve the problem of MySQL remote login permission
- NiO programming service
- 3. abstract class (shape)
- sql语法检测
- ABAP query tutorial in sap: sq01, sq02, sq03-017
- JS获取数据类型方法总结
- Basic knowledge of audio and video | analysis of ANS noise suppression principle
- SAP ABAP 子屏幕教程:在 SAP 中调用子屏幕-010
- VHEDT业务发展框架
猜你喜欢

北京恢复堂食半月记:如何重燃门店经营烟火气

【C语言】库函数qsort的使用

The odoo system sets priorities for the views independently developed by the original model

Static assertion static_ assert

数睿数据受邀参与南通企业数字化转型研讨会

SAP ABAP 中的 Smart Forms-014

让代码优雅起来(学会调试+代码风格)

CUMT学习日记——数字图像处理考试速成笔记

什么是RESTful,REST api设计时应该遵守什么样的规则?

SAP ABAP data types, operators and editors-02
随机推荐
[Shanda conference] use typescript to reconstruct the project
C语言贪吃蛇
NiO uses writable events to handle the situation of one-time write incompleteness
Odoo local document function development record
Summary of Changan chain usage skills
Basic knowledge of audio and video | analysis of ANS noise suppression principle
LeetCode_回溯_动态规划_中等_131.分割回文串
Swift -- 保存打印日志到沙盒
解决mysql远程登录报权限问题
3.抽象类(shape)
Unity游戏优化(第2版)学习记录8
SAP web service 无法使用 SOAMANAGER 登陆到SOA管理页面
数睿数据荣获第二届ISIG中国产业智能大会两项年度大奖
Runtime -- explore the nature of classes, objects, and classifications
什么是 SAP ABAP? 类型、ABAP 完整形式和含义
Safari兼容性问题总结
Smart forms-014 in SAP ABAP
NiO programming service
Make the text template in pycharm project support jinjia2 syntax
SAP abap 数据类型,操作符和编辑器-02