-- 用root登录
mysql -h127.0.0.1 -P2883 -uroot@sys#obcluster -A -c -pHUAxin123.
-- 查看可⽤的 CPU 和内存:
SELECT
svr_ip,
svr_port,
zone,
cpu_capacity,
cpu_assigned,
cpu_capacity - cpu_assigned cpu_free,
round(mem_capacity / 1024 / 1024 / 1024, 1) mem_total_GB,
round(mem_assigned / 1024 / 1024 / 1024, 1) mem_assigned_GB,
round((mem_capacity - mem_assigned) / 1024 / 1024 / 1024, 1) mem_free_GB,
round(data_disk_capacity / 1024 / 1024 / 1024, 1) disk_total_GB,
round(data_disk_in_use / 1024 / 1024 / 1024, 1) disk_assigned_GB,
round(memory_limit / 1024 / 1024 / 1024, 1) memory_limit_GB
FROM
__all_virtual_server
ORDER BY
zone
cpu_free 设置x
mem_free 设置y
-- 创建资源
CREATE RESOURCE UNIT IF NOT EXISTS unit1
MAX_CPU X,
MIN_CPU X,
MEMORY_SIZE 'YG',
MAX_IOPS 1250,
MIN_IOPS 1250,
LOG_DISK_SIZE '20G';
CREATE RESOURCE UNIT IF NOT EXISTS unit2
MAX_CPU 6,
MIN_CPU 6,
MEMORY_SIZE '6G',
MAX_IOPS 1250,
MIN_IOPS 1250,
LOG_DISK_SIZE '20G';
-- 创建资源池
CREATE RESOURCE POOL IF NOT EXISTS pool2
unit = 'unit2',
unit_num = 1,
zone_list =('zone_1');
-- 创建oracle 租户
CREATE TENANT IF NOT EXISTS oraclet
charset = 'utf8mb4',
zone_list =('zone_1'),
primary_zone = 'zone_1',
resource_pool_list =('pool2')
SET
ob_tcp_invited_nodes = '%',
ob_compatibility_mode = 'oracle';
-- 用oracle 租户登录
obclient -h127.0.0.1 -P2883 -usys@oraclet#obcluster -A -c
-- 设置密码
ALTER USER sys IDENTIFIED BY "HUAxin1234.";
obclient -h127.0.0.1 -P2883 -usys@oraclet#obcluster -A -c -pHUAxin1234.
-- 创建数据库
CREATE DATABASE hx DEFAULT CHARACTER SET utf8mb4;
在oracle中创建
--创建用户
CREATE USER hx IDENTIFIED BY "HUAxin123.";
GRANT dba TO hx;
obclient -h127.0.0.1 -P2883 -uhx@oraclet#obcluster -A -c -pHUAxin123.
oceanbase-oracle租户
于 2024-03-28 11:18:44 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)