初次学习使用达梦数据库DM8在麒麟V10操作系统上的安装配置和使用。
虚拟机环境信息:
麒麟V10操作系统:
[root@dm8 /]# cat /etc/os-release
NAME="Kylin Linux Advanced Server"
VERSION="V10 (Sword)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Sword)"
ANSI_COLOR="0;31"
一、操作系统配置
1、查看CPU信息 lscpu
CPU 运行模式: 32-bit, 64-bit
CPU: 2
2、查看内存的信息,内存至少要求1G以上
# free -m
total used free shared buff/cache available
Mem: 2888 647 1563 12 677 1967
Swap: 4043 0 4043
3、查看硬盘和分区的信息,/tmp分区至少要求1G以上
[root@dm8 Desktop]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 1.4G 0 1.4G 0% /dev
tmpfs 1.5G 0 1.5G 0% /dev/shm
tmpfs 1.5G 9.6M 1.5G 1% /run
tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup
/dev/mapper/klas-root 51G 8.9G 42G 18% /
tmpfs 1.5G 96K 1.5G 1% /tmp
/dev/sda1 1014M 213M 802M 21% /boot
tmpfs 289M 44K 289M 1% /run/user/0
4、网络配置,卡支持 TCP/IP 协议,100M以上
# ethtool ens33
Settings for ens33:
Speed: 1000Mb/s
Duplex: Full
5、关闭防火墙:
# systemctl stop firewalld
# systemctl disable firewalld
# systemctl status firewall
6、系统要求内核要求2.6版本以上
uname -a
7、创建组和用户
# groupadd dinstall
# useradd -g dinstall dmdba
修改用户名的口令
# passwd dmdba
8、安装目录
# mkdir -p /dm8
# chown dmdba:dinstall /dm8
二、安装dm8数据库软件
1、软件包挂载
# mount -o loop /home/dmdba/ dm8_0818_x86_rh6_64_ent_8.4.2.18_pack14\ \(1\).iso /mnt
2、设置GUI
# export DISPLAY=:0.0;
# xhost +
3、安装软件
# su - dmdba
$ cd /mnt
$ ./DMInstall.bin
安装时,可以不需要key文件。需要导入key文件时,将key文件拷贝到数据库安装目录/dm8的bin目录下,重启数据库实例生效即可。
三、创建数据库实例
# export DISPLAY=:0.0;
# xhost +
# su - dmdba
$ cd /dm8/tool
$ ./dbca.sh
四、登录管理数据库
1、使用disql登录连接数据库
# su - dmdba
$ cd /dm8/bin
$ ./disql sysdba/Dameng123:5238
服务器[LOCALHOST:5238]:处于普通打开状态
登录使用时间 : 3.712(ms)
disql V8
SQL> select sysdate from dual;
行号 SYSDATE
---------- -------------------
1 -07-28 09:28:41
已用时间: 31.690(毫秒). 执行号:300.
2、使用manager登录连接数据库
# export DISPLAY=:0.0;
# xhost +
# su - dmdba
$ cd /dm8/tool
$ ./manager
3、管理数据库状态
shutdown:数据库关闭状态
mount:数据库配置状态,比如开启数据库归档
open:数据库打开状态,提供对外服务
suspend:挂起状态,只读
SQL> alter database mount;
操作已执行
已用时间: 373.907(毫秒). 执行号:0.
SQL> alter database open;
操作已执行
已用时间: 333.516(毫秒). 执行号:0.
SQL>
SQL> alter database suspend;
操作已执行
已用时间: 101.383(毫秒). 执行号:0.
SQL> alter database open;
操作已执行
已用时间: 0.432(毫秒). 执行号:0.
4、数据库的启动与关闭
通过服务的方式关闭和启动数据库
cd /dm8/bin
$ ./DmServiceDMSERVER stop
Stopping DmServiceDMSERVER: [ OK ]
$ ./DmServiceDMSERVER start
Starting DmServiceDMSERVER: [ OK ]
通过前台的方式启动和关闭数据库
su – dmdba
cd /dm8/bin
$ ./dmserver /dm8/data/DAMENG/dm.ini
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 4-2-18-21.08.20-146029-10013-ENT startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on -08-20
file lsn: 37014
ndct db load finished
ndct fill fast pool finished
iid page's trxid[8048]
NEXT TRX ID = 8049
pseg_collect_mgr_items, total collect 0 active_trxs, 0 cmt_trxs, 0 pre_cmt_trxs, 0 active_pages, 0 cmt_pages, 0 pre_cmt_pages, 0 mgr pages, 0 mgr recs!
total 0 active crash trx, pseg_crash_trx_rollback sys_only(0) begin ...
pseg_crash_trx_rollback end, total 0 active crash trx, include 0 empty_trxs, 0 empty_pages which only need to delete mgr recs.
pseg_crash_trx_rollback end
pseg recv finished
nsvr_startup end.
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info success.
nsvr_process_before_open begin.
nsvr_process_before_open success.
total 0 active crash trx, pseg_crash_trx_rollback sys_only(0) begin ...
pseg_crash_trx_rollback end, total 0 active crash trx, include 0 empty_trxs, 0 empty_pages which only need to delete mgr recs.
pseg_crash_trx_rollback end
SYSTEM IS READY.
退出exit即可关闭数据库
exit
Server is stopping...
listener closed and all sessions disconnected
purge undo records in usegs...OK
full check point starting...
generate force checkpoint, rlog free space[402492416], used space[148480]
checkpoint begin, used_space[148480], free_space[402492416]...
checkpoint end, 0 pages flushed, used_space[152064], free_space[402488832].
full check point end.
shutdown audit subsystem...OK
shutdown schedule subsystem...OK
shutdown timer successfully.
pre-shutdown MAL subsystem...OK
shutdown worker threads subsystem...OK
shutdown local parallel threads pool successfully.
shutdown replication subsystem...OK
shutdown sequence cache subsystem...OK
wait for mtsk link worker to exit..OK
shutdown mpp session subsystem...OK
wait for rapply is all over... OK
rapply worker threads exit successfully.
pre ending task & worker threads...OK
shutdown dblink subsystem...OK
shutdown session subsystem...OK
shutdown rollback segments purging subsystem...OK
shutdown rps subsystem...OK
shutdown transaction subsystem...OK
shutdown locking subsystem...OK
shutdown dbms_lock subsystem...OK
ending tsk and worker threads...OK
ckpt2_exec_immediately begin.
checkpoint begin, used_space[152064], free_space[402488832]...
checkpoint end, 0 pages flushed, used_space[20480], free_space[402620416].
checkpoint begin, used_space[20480], free_space[402620416]...
checkpoint end, 0 pages flushed, used_space[20480], free_space[402620416].
checkpoint begin, used_space[20480], free_space[402620416]...
checkpoint end, 0 pages flushed, used_space[0], free_space[402640896].
checkpoint begin, used_space[0], free_space[402640896]...
checkpoint end, 0 pages flushed, used_space[0], free_space[402640896].
shutdown archive subsystem...OK
shutdown redo log subsystem...OK
shutdown MAL subsystem...OK
shutdown message compress subsystem successfully.
shutdown task subsystem...OK
shutdown trace subsystem...OK
shutdown svr_log subsystem...OK
shutdown plan cache subsystem...OK
shutdown file subsystem...OK
shutdown database dictionary subsystem...OK
shutdown mac cache subsystem...OK
shutdown dynamic login cache subsystem...OK
shutdown ifun/bifun/sfun/afun cache subsystem...OK
shutdown crypt subsystem...OK
shutdown pipe subsystem...OK
shutdown compress component...OK
shutdown slave redo subsystem...OK
shutdown kernel buffer subsystem...OK
shutdown SQL capture subsystem...OK
shutdown control file system...OK
shutdown dtype subsystem...OK
shutdown huge buffer and memory pools...OK
close lsnr socket
DM Database Server shutdown successfully.
结言:通过实验可以很快上手安装配置好达梦DM8数据库,安装操作简单便捷,达梦DM8配置多个可视化界面管理、配置、运维、监控数据库,大大的带来管理使用的便捷性,易用性,对刚接触达梦数据库的人来说非常友好,接下来将学习官方文档,学习达梦DM8数据库的其他功能,学习进阶的达梦数据库管理和维护。