一、创建用户
[root@sdb3 opt]# groupadd informix[root@sdb3 opt]# useradd -g informix -d /opt/informix -s /bin/bash -m informix[root@sdb3 opt]# passwd informix密码为 informix二、安装
在root用户下,解压安装包,执行安装
cd /ophp显示器t/informixtar -xf iif.11.70.FC8DE.linux-x86_64.tar ./ids_install默认安装到 /opt/IBM/informix ,具体安装过程可开光参考Centos6.8_x86_64安装使用 Informix11.70 数据库
三、设置环境变量
vi /opt/informix/.bash_profileexport INFORMIXDIR=/opt/IBM/informix/export PATH=$INFORMIXDIR/bin:$P计算机专业论文ATHexport INFORMIXSERVER=ol_informix1170export ONCONFIG=onconfig.ol_informix1170export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/sqlhosts.ol_informix1170export INFORMIXDIR INFORMIXSERVER ONCONFIG INFORMIXSQLHOSTS四、数据库基础管理操作
1. 初始化数据库 (首次启动数据的时候使用,以后不要执行带 -i参数,否则原数据库会被清空 )
$ oninit -ivy2. 启动/关闭数据库
$ oninit –v/ onmoweledade -sy (也带ky,sy为正常关闭)3. 清空共享内存及缓存
$ onclean -ky4. 查看服务状态
$ onstat -l五、 查看默认监听端口
使用命令查看
ps -elf | grep oninitnetstat -na | grep 27703打开 /etc/services文件查看服务端口
ol_informix1170 27703/tcp dr_informix1170 25423/tcp六、 设置自启动
编辑/etc/rc.local添加:
INFORMIXDIR=/op烘衣机t/IBM/informix INFORMIXSERVER=ol_informix1170 ONCONFIG=onconfig.ol_informix1170 NFORMIXSQLHOSTS=${INFORMI取样电阻XDIR}/etc/sql中学物理hosts.ol_informix1170 export INFORMIXDIR INFORMIXSERVER ON当代油画家CONFIG INFORMIXSQLHOSTS七、执行增删查改
执行dbaccess命令进入客户端
>dbaccess//创建表test ,其中两个字段分别为name和age如下类型:create table test (name varchar(20),age integer);//向test插入记录insert into test(name , age ) values("havi",10);insert into test(name , age ) values("havi2",11);insert into test(name , age ) values("havi3",12);//查询test这张表的记录select * from test;//删除记录delete from test where age = 10;//更新记录update test set age=9 where age=11八、其他操作
// informix 查看数据库名onstat -c | grep DBSERVER// informix 执行数据导出unload to /opt/inf伪娘什么意思ormix/abc.csv delimiter "," select * from test;// informix 导出表结构dbschema -d test -t all db.sql// informix 使用命令行的方式执行 test.sqldbaccess test test.sql // informix 获取databa中国印尼se下的表dbschema -d test -t all | grep TABLE | awk '{print $3}' | cut -d \. -f 2// informix 获取用户下的所有databaseselect name from sysmaster:sysdatabases;/中国管理科学院/ informix 获取test这个database下的表select dbsname,tabname from sysmaster:systabnames where dbsname='test';// informix 获取户口迁移需要什么材料所有datab思科交换机配置ase下的表select * fro医学scim sysmaster:systabnames ;// informix 获取当前连接的database下用户自己创建的表select * from systables where tabtype='T' and tabid>99;// informix 获取所有的表select * from systables // informix 给test表添加num字段,类型为曼哈顿怪兽integer alter tab视频播放速度le test add num integer// informix 创建唯一索引(其中test为表名 , age为需要创建的字段)alter table test modify age integer primary key ;// informix 查找外键select constrname from sysconstraints where c东风5bonstrtype='R' and tabid= ( select tabid from systables where tabname = 'test' ) ;// informix 查找主键select constrname from sysconstraints where constrtype='P' and tabid= ( select tabid from systables where tabname = 'test' );//查找tabid为103的主键select * 北京舞蹈学院继续教育学院from 西南财经大学研究生分数线sysconstraints where tabid=103;// informix 删除主键alte浙江选考吧r table tablename drop constraint constrname;//如删除名为 u103_13 的主键:alter table test drop constraint u103_13;本文发布于:2023-06-08 13:13:11,感谢您对本站的认可!
本文链接:http://www.ranqi119.com/ge/85/257400.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |