??xml version="1.0" encoding="utf-8" standalone="yes"?> --存储q程如何调用触发? --我们有一个table如下Q需要跟t修改对该表的insert/update/delete操作Q?br /> Problems with the database usually result in messages being written to the Informix message log, which is stored in /usr/sgi/informix/online.log. You should monitor this file periodically. In addition, if problems with the database occur, view this message log for relevant information.
This section describes how to troubleshoot problems with the Informix database. The following topics are discussed:
You can find additional information about Informix in these sections:
If the Informix database runs out of space, you will see a message in the Informix log (/usr/sgi/informix/online.log) that is similar to the following:
By default, the Informix database information is stored in /usr/sgi/informix/data/root_chunk. To add more space to the database without bringing down MediaBase or the Informix server:
absolutePath is the absolute pathname of the location of extend_root_chunk, for example, /usr/sgi/informix/data/extend_root_chunk.
Wait until you see messages similar to the following:
When you see these messages, the Informix server knows it has the additional space and will use it automatically.
If the Informix database runs out of locks, you will see many messages in the Informix log (/usr/sgi/informix/online.log) similar to the following:
Note: One or a few messages like this in the log are normal. A problem exists only if you see this message many times.
To recover from this problem:
If Informix does not stop, you can stop it by entering the following:
If any shared memory segments belong to Informix, you will see output that looks similar to the following:
For example, the following removes the segment whose shared memory ID is 1202:
You may see the following message when initializing the database:
Two conditions can cause this error:
To recover from the error condition:
If Informix is running, you will see many processes.
If Informix is running, you will see the message If any shared memory segments belong to Informix, you see output that looks similar to the following:
For example, the following removes the segment whose shared memory ID is 1202:
If you see a message that If you see a message such as
Make sure to configure the event logging threshold to debug.
create trigger test on table
for insert
as
exec 存储q程?br />go
create proc test
as
update table set ...
insert table select ...
delete table ...
create table testMonitor(c1 int, c2 char(10))
--创徏的辅助表如下Q?br />
create table tempLog_testMonitor(
rowID bigint identity(1,1),
hostname nchar(128),
program_name nchar(128),
nt_domain nchar(128),
nt_username nchar(128),
net_address nchar(12),
loginame nchar(128),
login_time datetime,
EventType nvarchar(30),
parameters int,
EventInfo nvarchar(255)
)
--创徏的trigger如下Q?br />
create trigger trg_testMonitor
on testMonitor
for insert,update,delete
as
begin
declare @hostname nchar(128)
declare @program_name nchar(128)
declare @nt_domain nchar(128)
declare @nt_username nchar(128)
declare @net_address nchar(12)
declare @loginame nchar(128)
declare @login_time datetime
declare @rowID bigint
insert into tempLog_testMonitor(EventType,parameters,EventInfo)
exec ('dbcc inputbuffer(@@spid)')
select @rowID = scope_identity()
select @hostname = hostname,
@program_name = program_name,
@nt_domain = nt_domain,
@nt_username = nt_username,
@net_address = net_address,
@loginame = loginame,
@login_time = login_time
from master..sysprocesses where spid = @@spid
update tempLog_testMonitor set
hostname = @hostname,
program_name = @program_name,
nt_domain = @nt_domain,
nt_username = @nt_username,
net_address = @net_address,
loginame = @loginame,
login_time = @login_time
where rowID = @rowID
end
--如果我们执行如下的语句:
insert into testmonitor values(1,'aaa')
update testmonitor set c2 = 'bbb'
delete from testmonitor
--您再查询辅助表,p看到对表修改的相关信息:
select * from tempLog_testMonitor
]]>
Running Out of Space
SQLSTATE IX000: ISAM error: no free disk space
#
su - informix
#
touch extend_root_chunk
#
chown informix.informix extend_root_chunk
#
chmod 660 extend_root_chunk
#
setenv INFORMIXSERVER odlshm
#
setenv INFORMIXDIR /usr/sgi/informix
#
cd /usr/sgi/informix/bin
#
onspaces -a rootdbs -p absolutePath -o 0 -s 200000
Adding chunk...
Successfully Added chunk...
#
Running Out of Locks
19:58:09 Lock table overflow - user id 55555, session id 1691
#
/etc/init.d/mediabase stop
#
/etc/init.d/informix stop
#
killall oninit
#
ipcs -ma
IPC status from /dev/kmem as of Tue Jul 23 21:21:04 1996
T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME
Shared Memory:
m 1202 0x52564801 --rw-rw---- root informix root informix 12 5054464 16912 19696 21:21:00 21:21:01 20:23:00
m 1203 0x52564802 --rw-rw---- root informix root informix 12 8192000 16912 19696 21:21:00 21:21:01 20:23:00
m 1204 0x52564803 --rw-rw-rw- root informix root informix 14 622592 16912 19696 21:21:00 21:21:01 20:23:10
m 1206 0x52564804 --rw-rw---- root informix root informix 12 8388608 16912 19696 21:21:00 21:21:01 20:41:38
#
ipcrm -m SHARED_MEMORY_SEGMENT_ID
#
ipcrm -m 1202
#
/etc/init.d/informix start
#
/etc/init.d/mediabase start
Shared Memory Creation Error
oninit: Fatal error in shared memory creation
# ps -ef | grep oninit
/usr/mbase/sbin/chkserveron
ODL server ready
.
#
ipcs -ma
IPC status from /dev/kmem as of Tue Jul 23 21:21:04 1996
T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME
Shared Memory:
m 1202 0x52564801 --rw-rw---- root informix root informix 12 5054464 16912 19696 21:21:00 21:21:01 20:23:00
m 1203 0x52564802 --rw-rw---- root informix root informix 12 8192000 16912 19696 21:21:00 21:21:01 20:23:00
m 1204 0x52564803 --rw-rw-rw- root informix root informix 14 622592 16912 19696 21:21:00 21:21:01 20:23:10
m 1206 0x52564804 --rw-rw---- root informix root informix 12 8388608 16912 19696 21:21:00 21:21:01 20:41:38
#
ipcrm -m SHARED_MEMORY_SEGMENT_ID
#
ipcrm -m 1202
posuser Error Message
posuser
is not found, the MediaBase system is probably using a shadow password file. To fix this, use the IRIX pwconv utility to install and update /etc/shadow with the information in /etc/passwd.
Cannot Connect Error Message
cannot open
or cannot connect
, suspect:
Next | Prev | Up | Top | Contents | Index
]]>
I'm a programmer, but I need to install IDS 7.31 I have one server compaq (intel pentium) with Unixware 7.1.1 I read the documentation but my problem continues. When I start the Database server with the 'oninit -i' instruction, I see the next error: "oninit: Fatal error in shared memory creation" Somebody help me, please¡ Sorry for my english. |
|
|
|
ideation 发表?2005-6-8 16:26:22
在java对oracle的操作中Q日期字D|很头疼的事情Q其实仔l研I一下也q不难掌握?/p> 举个例子来说明: ?book 中有name varchar2(20)//书籍名称,buydate Date //购买日期 两个字段?/p> 已经创徏了数据库q接Connection conn; Ҏ一、用java.sql.Date实现比较单的yyyy-mm-dd格式日期?/p> java.sql.Date不支持时间格式。切C要用new java.sql.Date(int year,int month,int date),因ؓq要处理旉差问题?/p> PreparedStatement pstmt = conn.prepareStatement("insert into book (name,buydate) values (?,?)"); java.sql.Date buydate=java.sql.Date.valueOf("2005-06-08"); Ҏ二、用java.sql.Timestamp,同上不用new Timestamp(....) PreparedStatement pstmt = conn.prepareStatement("insert into book (name,buydate) values (?,?)"); java.sql.Timestamp buydate=java.sql.Timestamp.valueOf("2004-06-08 05:33:99"); Ҏ三、用oracle 的to_date内置函数 PreparedStatement pstmt = conn.prepareStatement("insert into book (name,buydate) values (?,to_date(?, 'yyyy-mm-dd hh24:mi:ss')"); String buydate="2004-06-08 05:33:99"; ?oracle日期格式参数 含义说明 |
1、打开SQL企业理器,在控制台根目录中依次点开Microsoft SQL Server
2、SQL Serverl?->双击打开你的服务?->双击打开数据库目?BR>3、选择你的数据库名Uͼ如论坛数据库ForumQ?->然后点上面菜单中的工?->选择备䆾数据?BR>4、备份选项选择完全备䆾Q目的中的备份到如果原来有\径和名称则选中名称点删除,然后Ҏ加,如果原来没有路径和名U则直接选择dQ接着指定路径和文件名Q指定后点确定返回备份窗口,接着点确定进行备?
二、还原数据库
1、打开SQL企业理器,在控制台根目录中依次点开Microsoft SQL Server
2、SQL Serverl?->双击打开你的服务?->点图标栏的新建数据库图标Q新建数据库的名字自行取
3、点L建好的数据库名称Q如论坛数据库ForumQ?->然后点上面菜单中的工?->选择恢复数据?BR>4、在弹出来的H口中的q原选项中选择从设?->炚w择讑֤-->Ҏ?->然后选择你的备䆾文g?->d后点定q回Q这时候设备栏应该出现您刚才选择的数据库备䆾文g名,备䆾号默认ؓ1Q如果您对同一个文件做q多ơ备份,可以点击备䆾h边的查看内容Q在复选框中选择最新的一ơ备份后点确定)-->然后点击上方常规旁边的选项按钮
5、在出现的窗口中选择在现有数据库上强制还原,以及在恢复完成状态中选择使数据库可以l箋q行但无法还原其它事务日志的选项。在H口的中间部位的数据库文gq原里要按照你SQL的安装进行设|(也可以指定自q目录Q,逻辑文g名不需要改动,U至物理文g名要Ҏ你所恢复的机器情况做改动Q如您的SQL数据库装在D:\Program Files\Microsoft SQL Server\MSSQL\DataQ那么就按照您恢复机器的目录q行相关改动改动Qƈ且最后的文g名最好改成您当前的数据库名(如原来是bbs_data.mdfQ现在的数据库是forumQ就Ҏforum_data.mdfQ,日志和数据文仉要按照这L方式做相关的改动Q日志的文g名是*_log.ldfl尾的)Q这里的恢复目录您可以自p|,前提是该目录必须存在Q如您可以指定d:\sqldata\bbs_data.mdf或者d:\sqldata\bbs_log.ldfQ,否则恢复报?BR>6、修改完成后Q点M面的定q行恢复Q这时会出现一个进度条Q提C恢复的q度Q恢复完成后pȝ会自动提C成功,如中间提C报错,误录下相关的错误内容ƈ询问对SQL操作比较熟悉的h员,一般的错误无非是目录错误或者文件名重复或者文件名错误或者空间不够或者数据库正在使用中的错误Q数据库正在使用的错误您可以试关闭所有关于SQLH口然后重新打开q行恢复操作Q如果还提示正在使用的错误可以将SQL服务停止然后重v看看Q至于上q其它的错误一般都能按照错误内容做相应改动后即可恢?BR>
三、收~数据库
一般情况下QSQL数据库的收羃q不能很大程度上减小数据库大,其主要作用是收羃日志大小Q应当定期进行此操作以免数据库日志过?/P>
1、设|数据库模式为简单模式:打开SQL企业理器,在控制台根目录中依次点开Microsoft SQL Server-->SQL Serverl?->双击打开你的服务?->双击打开数据库目?->选择你的数据库名Uͼ如论坛数据库ForumQ?->然后点击右键选择属?->选择选项-->在故障还原的模式中选择“简单”,然后按确定保?BR>2、在当前数据库上点右键,看所有Q务中的收~数据库Q一般里面的默认讄不用调整Q直接点定
3?STRONG>收羃数据库完成后Q徏议将您的数据库属性重新设|ؓ标准模式Q操作方法同W一点,因ؓ日志在一些异常情况下往往是恢复数据库的重要依?
四、设定每日自动备份数据库
强烈有条件的用户q行此操作!
1、打开企业理器,在控制台根目录中依次点开Microsoft SQL Server-->SQL Serverl?->双击打开你的服务?BR>2、然后点上面菜单中的工具-->选择数据库维护计划器
3、下一步选择要进行自动备份的数据-->下一步更新数据优化信息,q里一般不用做选择-->下一步检查数据完整性,也一般不选择
4、下一步指定数据库l护计划Q默认的?周备份一ơ,点击更改选择每天备䆾后点定
5、下一步指定备份的盘目录Q选择指定目录Q如您可以在D盘新Z个目录如Qd:\databakQ然后在q里选择使用此目录,如果您的数据库比较多最好选择为每个数据库建立子目录,然后选择删除早于多少天前的备份,一般设?Q?天,q看您的具体备䆾要求Q备份文件扩展名一般都是bakq默认?BR>6、下一步指定事务日志备份计划,看您的需要做选择-->下一步要生成的报表,一般不做选择-->下一步维护计划历史记录,最好用默认的选项-->下一步完?BR>7、完成后pȝ很可能会提示Sql Server Agent服务未启动,先点定完成计划讑֮Q然后找到桌面最双状态栏中的SQLl色图标Q双ȝ开Q在服务中选择Sql Server AgentQ然后点击运行箭_选上下方的当启动OS时自动启动服?BR>8、这个时候数据库计划已经成功的运行了Q他按照您上面的设|进行自动备?
修改计划Q?/STRONG>
打开企业理器,在控制台根目录中依次点开Microsoft SQL Server-->SQL Serverl?->双击打开你的服务?->理-->数据库维护计?->打开后可看到你设定的计划Q可以进行修Ҏ者删除操?
五、数据的转移Q新建数据库或{UL务器Q?/B>
一般情况下Q最好用备份和q原操作来进行{UL据,在特D情况下Q可以用导入导出的方式进行{U,q里介绍的就是导入导出方式,导入导出方式转移数据一个作用就是可以在收羃数据库无效的情况下用来减(收羃Q数据库的大,本操作默认ؓ您对SQL的操作有一定的了解Q如果对其中的部分操作不理解Q可以咨询动|相关h员或者查询网上资?/P>
1、将原数据库的所有表、存储过E导出成一个SQL文gQ导出的时候注意在选项中选择~写索引脚本和编写主键、外键、默认值和查约束脚本选项
2、新建数据库Q对新徏数据库执行第一步中所建立的SQL文g
3、用SQL的导入导出方式,Ҏ数据库导入原数据库中的所有表内容
出处Q?A >蓝色理想 责Q~辑Q?A target=_blank>冰点的冰蓝色
<Context path="/quality" docBase="quality" debug="0" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_quality_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/connectDB" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/connectDB">
<parameter>
<name>maxActive</name>
<!-- Maximum number of DB connections in pool.Set to 0 for no limit. -->
<value>100</value>
</parameter>
<parameter>
<name>maxIdle</name>
<!-- Maximum number of idle DB connections to retain in pool.Set to 0 for no limit. -->
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<!-- Maximum time to wait for a DB connection to become available in ms.An exception is thrown if this timeout is exceeded.Set to -1 to wait indefinitely. -->
<value>10000</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<!-- Abandoned DB connections are removed and recycled -->
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<!-- Use the removeAbandonedTimeout parameter to set the number of seconds a DB connection has been idle before it is considered abandoned. -->
<value>60</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<!-- Log a stack trace of the code which abandoned -->
<value>false</value>
</parameter>
<parameter>
<name>factory</name>
<!-DBCP Basic Datasource Factory -->
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<!-- Database User Name -->
<value>Iorishinier</value>
</parameter>
<parameter>
<name>password</name>
<!-- User Password -->
<value>mypasswd</value>
</parameter>
<parameter>
<name>driverClassName</name>
<!-- Database Driver Class Name -->
<value>net.sourceforge.jtds.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<!-- Database Address -->
<value>jdbc:jtds:sqlserver://127.127.127.127:1433/Northwind</value>
</parameter>
</ResourceParams>
</Context>
<!-- Database Config start -->
<resource-ref>
<description>connectDB test</description>
<res-ref-name>jdbc/connectDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!-- Database Config end -->
<%@ page contentType="text/html;charset=GBK"%>
<%@ page errorPage="error.jsp"%>
<%@ page import="javax.naming.*"%>
<%@ page import="javax.sql.*"%>
<%@ page import="java.sql.*"%>
<html>
<head>
</head>
<body>
<%
……………?BR> ……………?BR>
// 数据库操?BR> Context ctx=null;
Connection cnn=null;
Statement stmt=null;
ResultSet rs=null;
try
{
ctx=new InitialContext();
if(ctx==null)
throw new Exception("没有匚w的环?);
DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/connectDB");
if(ds==null)
throw new Exception("没有匚w数据?);
cnn=ds.getConnection();
stmt=cnn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery("select * from table1");
……………?BR> ……………?BR>
}
finally
{
if(rs!=null)
rs.close();
if(stmt!=null)
stmt.close();
if(cnn!=null)
cnn.close();
if(ctx!=null)
ctx.close();
}
%>
</body>
</html>