YashanDB数据库是全面自主设计研发,支持集中式、分布式和共享存储部署架构以及混合负载场景的超融合数据库。本文简要介绍了YashanDB的特性和部署架构,并部署1主1备的测试环境,验证数据库访问操作、主备切换高可用过程,以了解。
崖山数据库系统YashanDB是一种新型的数据库管理系统,由深圳计算科学研究院自主设计研发。它在经典数据库理论的基础上,融入了原创的有界计算理论、近似计算理论、并行可扩展理论和跨模融合计算理论。YashanDB在部署模式上支持单机/主备、共享集群、分布式等多种部署方式,覆盖OLTP/HTAP/OLAP交易和分析混合负载场景,支持大规模并发事务处理和混合事务-分析处理、在线实时分析、海量数据查询加速以及异构数据融合处理场景。
YashanDB数据库是全面自研的国产数据库,满足实时性和高并发下的性能和稳定性要求,同时具备主流的信创改造生态,符合应用迁移的标准。主要有以下特性:
YashanDB在部署架构上分为单实例的主备部署、分布式部署以及共享集群的部署模式,部署架构如下图所示:
三种部署模式分别适用于不同的场景,各自特性如下:
YashanDB数据库的内存架构如图,主要包括以下部分:
对于分布式架构,还有MDS元数据管理、CMS分布式集群管理和GTS分布式全局时间管理等线程;对于共享存储架构,还有共享集群间的同步消息处理、GRC全局资源访问控制、GLS全局锁服务和GCS全局缓存服务等专有线程。
1)YashanDB数据库1主1备部署服务器信息如下:
IP |
操作系统 |
CPU |
内存 |
YashanDB版本 |
角色 |
192.168.112.121 |
centos_7.4_x86_64 |
1核 |
2G |
23.1.1.100 |
主节点 |
192.168.112.122 |
Centos_7.4_x86_64 |
1核 |
2G |
23.1.1.100 |
备节点 |
2)安装默认端口
3)关闭防火墙
##关闭防火墙
# systemctl stop firewalld
##关闭开机自启
# systemctl disable firewalld
##检查防火墙状态
# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
4)开启SSH服务
##检查ssh服务
# systemctl start sshd.service
##检查ssh服务
# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2023-11-23 09:13:12 CST; 1h 38min ago
Docs: man:sshd(8)
man:sshd_config(5)
##1、创建用户
# useradd -d /home/yashan -m yashan
# passwd yashan
##2、配置sudoers
# chmod +w /etc/sudoers
#在/etc/sudoers添加内容
yashan ALL=(ALL) NOPASSWD:ALL
# chmod -w /etc/sudoers
##3、查看用户
# id yashan
uid=1002(yashan) gid=1002(yashan) groups=1002(yashan)
所有安装YashanDB的实例节点上必须规划的两个目录:
1)解压安装包
# tar -xzvf yashandb-personal-23.1.1.100-linux-x86_64.tar.gz -C /usr/local/yashandb/install
2)在主备节点创建安装目录
#mkdir /usr/local/yashandb
3)执行yasboot package命令生成配置文件
#cd /usr/local/yashandb/install
#./bin/yasboot package se gen --cluster yashandb -u yashan -p xxxx --ip 192.168.112.121,192.168.112.122 --port 22 --install-path /usr/local/yashandb/yasdb_home --data-path /usr/local/yashandb/yasdb_data --begin-port 1688 --node 2
192.168.112.121
ip:192.168.112.121 cpu cores is less than 2
ip:192.168.112.121 memroy is less than 4096MB
192.168.112.122
ip:192.168.112.122 cpu cores is less than 2
ip:192.168.112.122 memroy is less than 4096MB
hostid | group | node_type | node_name | listen_addr | replication_addr | data_path
-------------------------------------------------------------------------------------------------------------------------
host0001 | dbg1 | db | 1-1 | 192.168.112.121:1688 | 192.168.112.121:1689 | /usr/local/yashandb/yasdb_data
----------+-------+-----------+-----------+----------------------+----------------------+--------------------------------
host0002 | dbg1 | db | 1-2 | 192.168.112.122:1688 | 192.168.112.122:1689 | /usr/local/yashandb/yasdb_data
----------+-------+-----------+-----------+----------------------+----------------------+--------------------------------
Generate config success
4)上一步骤执行完毕后,当前目录下将生成yashandb.toml和hosts.toml两个配置文件,yashandb.toml为数据库集群的配置文件,hosts.toml为主机的配置文件。根据需要调整配置项,比如RUN_LOG_FILE_PATH和SLOW_LOG_FILE_PATH。
cluster = "yashandb"
create_simple_schema = false
uuid = "655eb2496767a825e8dda1d6c4da4d4e"
yas_type = "SE"
[[group]]
group_type = "db"
name = "dbg1"
[group.config]
CHARACTER_SET = "utf8"
ISARCHIVELOG = true
REDO_FILE_NUM = 4
REDO_FILE_SIZE = "128M"
[group.create_sql]
[[group.node]]
data_path = "/usr/local/yashandb/yasdb_data"
hostid = "host0001"
role = 1
[group.node.config]
LISTEN_ADDR = "192.168.112.121:1688"
REPLICATION_ADDR = "192.168.112.121:1689"
RUN_LOG_FILE_PATH = "/usr/local/yashandb/yasdb_home/yashandb/log/yashandb/db-1-1/run"
RUN_LOG_LEVEL = "INFO"
SLOW_LOG_FILE_PATH = "/usr/local/yashandb/yasdb_home/yashandb/log/yashandb/db-1-1/slow"
[[group.node]]
data_path = "/usr/local/yashandb/yasdb_data"
hostid = "host0002"
role = 2
[group.node.config]
LISTEN_ADDR = "192.168.112.122:1688"
REPLICATION_ADDR = "192.168.112.122:1689"
RUN_LOG_FILE_PATH = "/usr/local/yashandb/yasdb_home/yashandb/log/yashandb/db-1-2/run"
RUN_LOG_LEVEL = "INFO"
SLOW_LOG_FILE_PATH = "/usr/local/yashandb/yasdb_home/yashandb/log/yashandb/db-1-2/slow"
使用以下命令执行安装
#./bin/yasboot package install -t hosts.toml -i /usr/local/src/yashandb-personal-23.1.1.100-linux-x86_64.tar.gz -f
checking install package...
install version: yashandb 23.1.1.100
host0001 100% [====================================================================] 6s
host0002 100% [====================================================================] 6s
update host to yasom...
注:指定参数-f不强制校验环境是否满足部署条件,否则会提示:
192.168.112.121
ip:192.168.112.121 cpu cores is less than 2
ip:192.168.112.121 memroy is less than 4096MB
1)执行部署命令
$ ./bin/yasboot cluster deploy -t yashandb.toml
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
task | 3190567c61c193bc | DeployYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 59
------+------------------+--------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS
2)生效环境变量
#部署命令成功执行后将会在$YASDB_HOME目录下的conf文件夹中生成<<集群名称>>.bashrc环境变量文件
$ cd /usr/local/yashandb/yasdb_home/yashandb/23.1.1.100/conf
# 如~/.bashrc中已存在YashanDB相关的环境变量,将其清除
$ cat yashandb.bashrc >> ~/.bashrc
$ source ~/.bashrc
3)开机后启动命令
yashoot process yasom start -c yashandb
yasboot process yasagent start -c yashandb
yasboot cluster start -c yashandb
通过yasboot工具设置集群内所有节点sys用户的密码
#./bin/yasboot cluster password set -n xxxx -c yashandb
type | uuid | name | hostid | index | status | return_code | progress | cost
----------------------------------------------------------------------------------------------------------
task | ce83dacc3c2e4246 | YasdbPasswordSet | - | yashandb | SUCCESS | 0 | 100 | 2
------+------------------+------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS
1)查看数据库状态
$ ./bin/yasboot cluster status -c yashandb -d
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
----------------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | db | 1-1:1 | 16119 | open | normal | primary | 192.168.112.121:1688 | /usr/local/yashandb/yasdb_data/db-1-1
----------+-----------+--------+-------+-----------------+-----------------+---------------+----------------------+---------------------------------------
host0002 | db | 1-2:2 | 15363 | open | normal | standby | 192.168.112.122:1688 | /usr/local/yashandb/yasdb_data/db-1-2
----------+-----------+--------+-------+-----------------+-----------------+---------------+----------------------+---------------------------------------
2)连接实例查看状态
$ ./bin/yasboot sql -d sys@192.168.112.121:1688
YashanDB SQL Personal Edition Release 23.1.1.100 x86_64
please input password: xxxx
Connected to:
YashanDB Server Personal Edition Release 23.1.1.100 x86_64 - X86 64bit Linux
SQL> SELECT STATUS FROM V$INSTANCE;
SELECT STATUS FROM V$INSTANCE;
STATUS
-------------
OPEN
1 row fetched.
SQL> SELECT database_name FROM v$database;
SELECT database_name FROM v$database;
DATABASE_NAME
----------------------------------------------------------------
yashandb
1 row fetched.
1)创建用户并授权
SQL> create user yasuser01 identified by "YashanDB01";
create user yasuser01 identified by "YashanDB01";
Succeed.
SQL> grant DBA to yasuser01;
grant DBA to yasuser01;
2)切换用户登录
#./bin/yasboot sql -d yasuser01@192.168.112.121:1688
Connected to:
YashanDB Server Personal Edition Release 23.1.1.100 x86_64 - X86 64bit Linux
SQL> SELECT database_name FROM v$database;
SELECT database_name FROM v$database;
DATABASE_NAME
----------------------------------------------------------------
yashandb
1)创建表空间
SQL> create tablespace ts01;
create tablespace ts01;
#删除表空间
SQL> drop tablespace ts01;
删除表空间默认会保留文件,如果再创建相同的表空间名称时,会提示文件已经存在,但是在备节点观察时该文件已经删除了。
YAS-02044 file '/usr/local/yashandb/yasdb_data/db-1-1/dbfiles/TS010' already exists
在删除表空间时指定删除文件datafiles
SQL> drop tablespace ts02 including contents and datafiles;
drop tablespace ts02 including contents and datafiles;
2)创建表和索引
##1、创建表tb01,表空间为TS01
create table if not exists tb01(
id int NOT NULL,
c1 int NOT NULL DEFAULT '0',
c2 char(120) NOT NULL DEFAULT '',
c3 char(60) NOT NULL DEFAULT '')
TABLESPACE TS01;
##查看创建的表
SQL> SELECT TABLE_NAME,TABLE_TYPE FROM USER_TABLES;
TABLE_NAME TABLE_TYPE
---------------------------------------------------------------- ----------
TB01 HEAP
##2、创建索引
SQL> create unique index uniq_ix01 on tb01(id);
SQL> create index ix_c1 on tb01(c1);
##查看索引
SQL> SELECT * FROM USER_INDEXES;
INDEX_NAME INDEX_TYPE TABLE_OWNER TABLE_NAME TABLE_TYPE UNIQUENESS COMPRESSION PREFIX_LENGTH TABLESPACE_NAME INI_TRANS MAX_TRANS PCT_FREE LOGGING BLEVEL LEAF_BLOCKS DISTINCT_KEYS AVG_LEAF_BLOCKS_PER_KEY AVG_DATA_BLOCKS_PER_KEY STATUS NUM_ROWS SAMPLE_SIZE LAST_ANALYZED PARTITIONED TEMPORARY GENERATED VISIBILITY DATABASE_MAINTAINED CONSTRAINT_INDEX
---------------------------------------------------------------- ----------------------------- ---------------------------------------------------------------- ---------------------------------------------------------------- --------------------------------------------- ---------- ----------- ------------- ---------------------------------------------------------------- ------------ ------------ ------------ ------- ------------ --------------------- --------------------- ----------------------- ----------------------- --------- --------------------- --------------------- -------------------------------- ----------- --------- --------- ------------- ------------------- ----------------
IX_C1 NORMAL YASUSER01 TB01 TABLE N DISABLED 0 USERS 2 255 8 Y VALID N N N VISIBLE N N
UNIQ_IX01 NORMAL YASUSER01 TB01 TABLE Y DISABLED 0 USERS 2 255 8 Y VALID N N N VISIBLE N N
2 rows fetched.
1)从mysql数据库中导出表数据为csv格式
mysql> SELECT * INTO OUTFILE '/tmp/sbtest.sbtest1.csv'
-> FIELDS TERMINATED BY ','
-> ENCLOSED BY '"'
-> LINES TERMINATED BY 'n'
-> FROM sbtest1 where id<10000;
Query OK, 9999 rows affected (0.09 sec)
2)使用yasldr工具将csv格式数据导入到表里
#./yasldr yasuser01/xxxx batch_size=4032 control_text="'LOAD DATA OPTIONS(DEGREE_OF_PARALLELISM=2) INFILE '/tmp/sbtest.sbtest1.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' AppEND INTO TABLE tb01(id,c1,c2,c3) '"
YashanDB Loader Personal Edition Release 23.1.1.100 x86_64 0e623bd
9999 rows successfully loaded.
Check /tmp/sbtest.sbtest1.log for more info.
[YASLDR] execute succeeded
导入的命令项有多个:
登录到表中查看数据情况
SQL> select count(1) from tb01 ;
COUNT(1)
---------------------
9999
1 row fetched.
3)使用exp和imp导出和导入到新表
#1、使用exp命令将yasuser01用户下所有数据导出至export. yasuser01.data文件中
[yashan@tango-DB01 ~]$ exp yasuser01/YashanDB01 FILE=export.yasuser01.dat OWNER=yasuser01
YashanDB Export Personal Edition Release 23.1.1.100 x86_64 0e623bd
export terminated successfully
[yashan@tango-DB01 ~]$ ll
total 1892
-rw-r----- 1 yashan yashan 1936736 Nov 23 19:54 export.yasuser01.dat
#2、使用imp命令将导出数据导入到yasuser02中
[yashan@tango-DB01 ~]$ imp yasuser02/YashanDB02 FILE=export.yasuser01.dat FROMUSER=yasuser01 TOUSER=yasuser02
YashanDB Import Personal Edition Release 23.1.1.100 x86_64 0e623bd
import terminated successfully
##查看表数据情况
SQL> SELECT table_name FROM USER_TABLES;
TABLE_NAME
----------------------------------------------------------------
TB01
1 row fetched.
SQL> select count(1) from tb01;
COUNT(1)
---------------------
9999
1 row fetched.
在1主1备的部署架构下,不同于1主多备的Raft协议自动选举,主节点故障通过yasom仲裁,默认是不开启的。
1)使用命令开启election
[yashan@tango-DB01 ~]$ yasboot
election enable on
-c yashandb
result: Succeed
查看仲裁选举的参数配置
[yashan@tango-DB01 ~]$ yasboot election config show -c yashandb
Protection Mode: MAXIMUM PROTECTION
Members:
[1-1:1] - Primary database
[1-2:2] - Physical standby database
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Apply Rate: 11.85 MByte/s
Properties:
FailoverThreshold = 9
FailoverAutoReinstate = false
ZeroDataLossMode = true
Automatic Failover: Enabled in Zero Data Loss Mode
默认是最大保护模式,表示redo log同步到备节点后,事务才提交。
另外通过以下命令修改配置
$ yasboot election enable off -c yashandb
$ yasboot election config set -k FailoverThreshold -v 2 -c yashandb
$ yasboot election enable on -c yashandb
$ yasboot election config show -c yashandb
2)检查主备集群的状态
[yashan@tango-DB01 ~]$ yasboot cluster status -c yashandb -d
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
----------------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | db | 1-1:1 | 16119 | open | normal | primary | 192.168.112.121:1688 | /usr/local/yashandb/yasdb_data/db-1-1
----------+-----------+--------+-------+-----------------+-----------------+---------------+----------------------+---------------------------------------
host0002 | db | 1-2:2 | 15363 | open | normal | standby | 192.168.112.122:1688 | /usr/local/yashandb/yasdb_data/db-1-2
----------+-----------+--------+-------+-----------------+-----------------+---------------+----------------------+---------------------------------------
3)模拟主节点故障,kill主节点进程
[yashan@tango-DB01 ~]$ ps -fu $USER
UID PID PPID C STIME TTY TIME CMD
yashan 1874 1 0 11:14 ? 00:00:10 /usr/local/yashandb/yasdb_home/yashandb/23.1.1.100/bin/yasom -c yashandb -l 192.168.112.121:1675 -d
yashan 1952 1 0 11:16 ? 00:01:17 /usr/local/yashandb/yasdb_home/yashandb/23.1.1.100/bin/yasagent -c yashandb -l 192.168.112.121:1676 -d
yashan 95091 1 7 16:23 ? 00:01:47 /usr/local/yashandb/yasdb_home/yashandb/23.1.1.100/bin/yasdb open -D /usr/local/yashandb/yasdb_data/db-1-1
[yashan@tango-DB01 ~]$ kill -9 95091
查看yasom.log日志,能看到failover切换信息
2023-11-25 16:47:38 DEBUG [yasom] replication.go:188 process replication event: failover
2023-11-25 16:47:38 INFO [yasom] task.go:24 call yasagent api success: NodeAPI.ExecSQL, get result: {"connection":"DISCONNECTED","status":"NORMAL","time_since_last_msg":
"2"}
2023-11-25 16:47:38 ERROR [yasom] task.go:21 call yasagent api failed: NodeAPI.ExecSQL, err: YAS-00402 failed to connect socket, errno 111, error message "Connection refu
sed"
2023-11-25 16:47:38 INFO [yasom] task.go:24 call yasagent api success: NodeAPI.ExecSQL, get result: {"database_role":"STANDBY","status":"NORMAL","switchover_status":"NOT
ALLOWED"}
2023-11-25 16:47:38 INFO [yasom] replication.go:231 execute failover sql command on node 1-2:2, next reset id is 1
2023-11-25 16:47:40 INFO [yasom] task.go:24 call yasagent api success: NodeAPI.ExecSQL, get result: {}
2023-11-25 16:47:40 INFO
[yasom] replication.go:246 failover succeeds
4)查看主备状态,备节点已经升级为主节点
[yashan@tango-DB02 ~]$ yasboot cluster status -c yashandb -d
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
---------------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | db | 1-1:1 | off | - | - | - | 192.168.112.121:1688 | /usr/local/yashandb/yasdb_data/db-1-1
----------+-----------+--------+------+-----------------+-----------------+---------------+----------------------+---------------------------------------
host0002 | db | 1-2:2 | 4410 | open | normal | primary | 192.168.112.122:1688 | /usr/local/yashandb/yasdb_data/db-1-2
----------+-----------+--------+------+-----------------+-----------------+---------------+----------------------+---------------------------------------
重启原来的主节点后,主备关系正常
[yashan@tango-DB02 ~]$ yasboot cluster status -c yashandb -d
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
-----------------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | db | 1-1:1 | 102613 | open | normal | standby | 192.168.112.121:1688 | /usr/local/yashandb/yasdb_data/db-1-1
----------+-----------+--------+--------+-----------------+-----------------+---------------+----------------------+---------------------------------------
host0002 | db | 1-2:2 | 4410 | open | normal | primary | 192.168.112.122:1688 | /usr/local/yashandb/yasdb_data/db-1-2
----------+-----------+--------+--------+-----------------+-----------------+---------------+----------------------+---------------------------------------
1)登录备机,检查主备机同步状态,确认主备机同步无异常
SQL> SELECT database_id,database_name,log_mode,open_mode,database_role FROM V$DATABASE;
DATABASE_ID DATABASE_NAME LOG_MODE OPEN_MODE DATABASE_ROLE
--------------------- ---------------------------------------------------------------- ----------------- ----------------- -----------------
2888093870 yashandb ARCHIVELOG READ_ONLY STANDBY
2)确认备机同步状态正常
SQL> SELECT connection, status, peer_addr, transport_lag, apply_lag FROM V$REPLICATION_STATUS;
CONNECTION STATUS PEER_ADDR TRANSPORT_LAG APPLY_LAG
----------------- ----------------- ---------------------------------------------------------------- ------------- ------------
CONNECTED NORMAL 192.168.112.121:1689 0 0
3)在备机执行switchover切换操作,此时主机的所有事务中断,且switchover执行过程中,客户端无法连接主机。
SQL>
alter database switchover;
切换完成后,查看主备机的角色是否发生变化
[yashan@tango-DB01 ~]$ yasboot cluster status -c yashandb -d
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
----------------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | db | 1-1:1 | 39926 | open | normal | standby | 192.168.112.121:1688 | /usr/local/yashandb/yasdb_data/db-1-1
----------+-----------+--------+-------+-----------------+-----------------+---------------+----------------------+---------------------------------------
host0002 | db | 1-2:2 | 38096 | open | normal | primary | 192.168.112.122:1688 | /usr/local/yashandb/yasdb_data/db-1-2
----------+-----------+--------+-------+-----------------+-----------------+---------------+----------------------+---------------------------------------
4)也可以使用yaboot命令执行主备切换
[yashan@tango-DB01 ~]$
yasboot node switchover -c yashandb -n 1-1
|key |value
|-----------------------------------------------+------
|clusterName |yashandb
|the group type of input node is |db
|the group name of input node is |dbg1
|the role of input node is |standby
|the primary node name of input node's group is |1-2
Switchover need primary node and selected node all are open and normal
Are you sure you want to switchover node 1-1 to primary: [yashandb][yes/no]: yes
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------------
task | 839275bfbfccf242 | SwitchoverYasdbCluster | - | dbg1 | SUCCESS | 0 | 100 | 2
------+------------------+------------------------+--------+-------+---------+-------------+----------+------
task completed, status: SUCCESS
其中参数-n为要升主的节点ID(例如1-1,可以通过cluster status命令查看,不需要冒号及后面的数字)。检查主备节点状态,确认已经发生了切换。
YashanDB提供的闪回功能,当用户误操作等原因导致表的数据被删除,使用闪回功能可以查看过去的数据状态,并在时间上倒回指定时间点的数据,无需从备份中恢复数据。注:该功能只对行存表(HEAP表)有效
#1、删除表tb01数据
SQL> delete from tb01 where id<100;
99 rows affected.
SQL> select count(1) from tb01 ;
COUNT(1)
---------------------
9900
1 row fetched.
#2、开启row movement
SQL> ALTER TABLE tb01 ENABLE ROW MOVEMENT;
Succeed.
#3、表数据闪回(通过时间戳闪回)
SQL> FLASHBACK TABLE tb01 TO TIMESTAMP TO_TIMESTAMP('2023/11/23 20:18:00','yyyy/mm/dd hh24:mi:ss');
FLASHBACK TABLE tb01 TO TIMESTAMP TO_TIMESTAMP('2023/11/23 20:18:00','yyyy/mm/dd hh24:mi:ss');
Succeed.
#4、查看数据返回正常
SQL> select count(1) from tb01 ;
COUNT(1)
---------------------
9999
1 row fetched.
#1、开启了回收站ALTER SYSTEM SET RECYCLEBIN_ENABLED=ON;
#2、删除表
SQL> drop table tb01 ;
#3、查询回收站是否存在TB01表
SQL> SELECT object_name FROM DBA_RECYCLEBIN WHERE original_name = 'TB01';
OBJECT_NAME
----------------------------------------------------------------
BIN$2260
#4、表结构及表数据闪回
SQL> FLASHBACK TABLE "BIN$2260" TO BEFORE DROP;
#5、表和索引已恢复
SQL> SELECT table_name FROM USER_TABLES;
TABLE_NAME
----------------------------------------------------------------
TB01
SQL> SELECT INDEX_NAME FROM USER_INDEXES WHERE TABLE_NAME = 'TB01';
INDEX_NAME
----------------------------------------------------------------
UNIQ_IX01
IX_C1
#1、开启了回收站ALTER SYSTEM SET RECYCLEBIN_ENABLED=ON;
#2、TRUNCATE表操作
SQL> truncate table tb01;
#3、查询回收站是否存在TB01表
SQL> SELECT object_name FROM DBA_RECYCLEBIN WHERE original_name = 'TB01';
OBJECT_NAME
----------------------------------------------------------------
TB01
#4、表结构及表数据闪回
SQL> FLASHBACK TABLE "TB01" TO BEFORE TRUNCATE;
#5、表数据已恢复
SQL> select count(1) from tb01;
COUNT(1)
---------------------
9999
本文简要介绍了YashanDB的特性以及部署架构,并测试部署了1主1备的环境进行功能性验证。总结下来有以下几点: