1.
环境变量设置:
在shell为tcsh的情况, 修改.tcshrc , 加入:
setenv DLC /home/progress/dlc
setenv WRKDIR /home/progress/wrk
setenv PROEXE $DLC/bin/_progres
setenv PROMSGS $DLC/promsgs
setenv PATH "……:
$DLC/bin"
2. Progress
数据库的启动:
progress安装后就已经有demo, sports,isports,sports2000,empty几个初始的数据库.
[root@xfs dlc]# pwd
/home/progress/dlc
[root@xfs dlc]# proserve sports
PROGRESS PATCH Version 9.1C09 as of February 26, 2002
13:54:25 BROKER : You are not allowed to connect to a database in $DLC. (1379)
13:54:25 BROKER : ** This process terminated with exit code 2. (8619)
以上信息表明我们不能在环境变量$DLC指定的路径下直接执行proserve命令初始化和sports数据库的连接.
[root@xfs dlc]# pwd
/root/sports
[root@xfs ~/sports]# ls /home/progress/dlc/sports.*
/home/progress/dlc/sports.b1 /home/progress/dlc/sports.db
/home/progress/dlc/sports.d1 /home/progress/dlc/sports.pl
[root@xfs ~/sports]# ls /home/progress/dlc/sports_*
/home/progress/dlc/sports_7.d1 /home/progress/dlc/sports_8.d1
[root@xfs ~/sports]# cp /home/progress/dlc/sports.* ./
[root@xfs ~/sports]# cp /home/progress/dlc/sports_* ./
[root@xfs ~/sports]# ls
sports_7.d1 sports_8.d1 sports.b1 sports.d1 sports.db sports.pl
sports.*和sports_*等文件是sports数据库存储在磁盘上的所有必须的文件, 我们把它们一起copy到/root/sports/下面, 就等于将sports数据库复制一份到/root/sports下面了.
[root@xfs ~/sports]#
proserve sports -S 2000 -N tcp
PROGRESS PATCH Version 9.1C09 as of February 26, 2002
18:00:01 BROKER 0: Multi-user session begin. (333)
18:00:01 BROKER 0: Begin Physical Redo Phase at 0 . (5326)
18:00:01 BROKER 0: Physical Redo Phase Completed at blk 0 off 167 upd 0. (7161)
18:00:01 BROKER 0: Started for 2000 using tcp, pid 26815. (5644)
-S 2000
表示在端口
2000
上提供
sports
数据库的连接服务
, -N tcp
表示以
tcp socket
提供连接
(
或者选择
udp),
如果不加上
-S 2000,
则
proserve sports
虽然没有出错信息
,
但并未能初始化
sports
数据库的连接服务
.
启动
sports
数据库的连接服务后
,
[root@xfs ~/sports]# netstat -a|grep 2000
tcp 0 0 *:2000 *:* LISTEN
[root@xfs ~/sports]# ls
sports_7.d1 sports.b1 sports.db sports.lic sports.pl
sports_8.d1 sports.d1 sports.lg sports.lk
可以看到多了sports.lg , sports.lic, sports.lk 3个文件.
[root@xfs ~/sports]# ps -ef | grep progress
root 25601 1 0 13:32 pts/0 00:00:00 /home/progress/dlc/bin/_mprosrv
_mprosrv为监控和提供数据库连接服务的进程.
3. SQLExplorer:
类似Oracle sql plus
的工具
[root@xfs ~/sports]#
sqlexp -H localhost -S 2000 -db sports
PROGRESS PATCH Version 9.1C09 as of February 26, 2002
Connecting user "root" to URL "jdbc:jdbcprogress:T:localhost:2000:sports"... (8920)
SQLExplorer>
这样就进入了SQLExplorer的命令行界面, 可在其下执行SQL语句进行表的创建和管理等. 在本机上执行的情况–H localhost可以省去, 但-S 2000不能省, 必须指定为上面proserve sports的时侯所指定的端口, 才能正确连接到sports数据库上去.
SQLExplorer命令行下输入SQL语句和命令时是大小写无关的, 但必须以”; “显式表明一个SQL语句的结束.
Progress数据库安装好以后就有一个并且只有一个唯一的DBA, 其用户名为sysprogress, 并且以其他用户名调用sqlexp进入SQLExplorer的时侯都不具备创建或修改任何表和数据的权限. 上面
sqlexp -H localhost -S 2000 -db sports 没有加-user 选项, 则SQLExplorer就认为使用sports数据库的用户名为unix用户即root, 我们接着执行create table命令的话可以看到用户root是不具备创建table的权限的:
SQLExplorer>create table test(
1> name varchar(20),
2> age integer
3> );
=== SQL Exception 1 ===
SQLState=HY000
ErrorCode=-20057
[JDBC Progress Driver]:No RESOURCE privileges (7574)
所以我们必须首先以sysprogress身分登入SQLExplorer, 然后grant权限给用户root:
[root@xfs ~/sports]# sqlexp -H localhost -S 2000 -user sysprogress -db sports
PROGRESS PATCH Version 9.1C09 as of February 26, 2002
Connecting user "sysprogress" to URL "jdbc:jdbcprogress:T:localhost:2000:sports"... (8920)
QLExplorer>create table test(
1> name varchar(20),
2> age integer
3> );
=== SQL Exception 1 ===
SQLState=HY000
ErrorCode=-211015
[JDBC Progress Driver]:Database object (table, view, index, trigger,procedure, or synonym) owned by "sysprogress" cannot be created, dropped, or altered. (7883) //sysprogress本身拥有的表,视图等是不可修改的, 因为sysprogress DBA相当于unix的超级用户, 为数据库安全起见不能对其修改.
查看系统中所有的表
: (
相当于
mysql
的
show tables;
命令
)
SQLExplorer>select * from sysprogress.systables;
ID TBL CREATOR &nbs