Note Although a status of zero is usually appropriate, it is not the only possible status value you can use. Reset the database to the actual, normal status it had prior to entering bypass recovery status.
1. Reset the database status to 0: 1> sp_configure "allow updates", 1 2> go 1> begin tran 2> go 1> use master 2> go 1> update sysdatabases set status=0 where name=<database_name> 2> go Check that the above update command affected only one row (if more than one row was affected, issue a rollback transaction.) Then commit the transaction and shut down Adaptive Server as follows: 1>commit tran 2>go 1>shutdown with nowait 2>go 2. Restart Adaptive Server. Run dbcc checkdb and dbcc checkalloc on the affected database to make sure there are no errors. Version in Which This Error is Raised All versions. 再次谢谢aladdin,freebob,changing。 6) 数据库表BCP出来报错 http://www.chinaunix.net/cgi-bin/bbs/topic.cgi?forum=10&topic=1326&show=300 数据库表BCP出来报错 DB-LIBRARY error I/O error while writing bcp data-file bcp出来的文件正好2GB,实际应该更大。 操作系统SCO OpenServer5.0.4, SYBASE 11.0.3 请问是何原因?谢谢。 当在后备数据量大于2GB的数据库时,可能会遇到以下错误: I/Oerror: operating system error,server device /backup/data. code 27 messages file too large. 这是由于后备文件的大小超出了操作系统的用户最大文件限制。而有些操作系统不支持大于2GB的文件,这时可以使用Backup Server将一个数据库后备到多个文件中。 1>dump database pubs2 to "/usr/sybase/pubs2_dump.1" 2>stripe on "/usr/sybase/pubs2_dump.2" 3>stripe on "/usr/sybase/pubs2_dump.3" 4>go 这种方法还可以提高后备及恢复的速度,但注意恢复也必须用相应多的设备。例如: 1>load database pubs2 from "/usr/sybase/pubs2_dump.1" 2>stripe on "/usr/sybase/pubs2_dump.2" 3>stripe on "/usr/sybase/pubs2_dump.3" 4>go
那好办,那你就可以使用下面语句将唯一的记录先插入到临时表中: select distinct a ,b,c,d ... into tempdb..tempdb_table from tablename 然后清空原表,把临时表中的数据插入正式表中! 试试看
可以参考这种经典方法: 1---select * into tmp_tab from your_dup_tab where 1=2 2---若表无唯一性索引则建一个唯一性索引(一定能找到一个唯一性的索引建(复合索引))create unique index(列名1,列名2...) on tmp_tab with ignore_dup_key. 3----insert into tmp_tab from your_dup_tab 这样在新表中将自动删出重复记录。但数据量过大请留意日志空间(sp_spaceused syslogs). 很使用的方法.try it!
sybase 临时数据库 缺省情况下,tempdb数据库是放置在master设备上,容量为2M,而临时数据库是活动最为平凡的数据库常常被用来排序、创建临时表、重格式化等操作,所以tempdb的优化应该受到特别的关注。本篇文章目的在于使你掌握临时数据库的优化策略以及临时表的优化使用。本文中,你将以调整临时库的位置开始,有步骤的完成临时数据库的优化,并在此过程中了解到优化临时数据库和临时表的一些方法和规则。 实验环境的要求:你应具有系统管理员的权限,系统中有auths和article表。 步骤: 第一步:调整临时库的位置 tempdb数据库缺省放在master设备上,将临时数据库发在分离的设备上是更可取的。 1) 初始化一个用来存放临时数据库的设备 disk init name="tempdb_dev", physname="d:\sybase\example\tempdb.dat", vdevno=13, size=15360 (注意:如果将tempdb数据库放在多个设备上,需初始化多个数据库设备) 2)将临时数据库扩展到该一个设备上 alter database tempdb on tempdb_dev=30 3)打开tempdb数据库,从段上删除master设备 sp_dropsegment "default",tempdb,master sp_dropsegment logsegment,tempdb,master 4)发出如下命令,检查default段中是否不再包含master设备 select dbid,name,segmap from sysusages,sysdevices where sysdevices.low<=syusages.size+vstart and sysdevices.high>=sysusages.size+vstart-1 and dbid=2 and(status=2 or status=3) 说明:若将临时数据库放在多个磁盘设备上,可以更好的利用并行查询特性来提高查询性能。 第二步:将临时数据库与高速缓冲进行绑定。 由于临时表的创建、使用,临时数据库会频繁地使用数据缓存,所以应为临时数据库创建高速缓存,从而可以使其常驻内存并有助于分散I/O: 1、创建命名高速缓存 sp_cacheconfig “tempdb_cache","10m","mixed" 2、重新启动server 3、捆绑临时数据库到tempdb_cache高速缓存 sp_bindcache “tempdb_cache", tempdb 4、若有大的I/O,配置内存池 第三步:优化临时表 大多数临时表的使用是简单的,很少需要优化。但需要对临时表进行复杂的访问则 应通过使用多个过程或批处理来把表的创建和索引分开。以下两种技术可以改善临时表的优化 slash; 在临时表上创建索引 1) 临时表必须存在 2) 统计页必须存在(即不能在空表上创建索引) slash; 把对临时表的复杂的使用分散到多个批处理或过程中,以便为优化器提供信息 下面的这个过程需要进行优化: create proc base_proc as select * into #huge_result from auths select * from article, #huge_result where article.author_code= #huge_result.author_code and sex="0" 使用两个过程可以得到更好的性能 1)create proc base_proc as select * into #huge_result from auths exec select_proc 2) create proc select_proc as select * from article,#huge_result where article.author_code=#huge_result.author_code and sex="0" 说明:在同一个存储过程或批处理中,创建并使用一个表时,查询优化器无法决定这个表的大小。 结论:通过本实验我们知道,临时数据库经过优化可以极大的提高系统性能。实际工作中,必须考虑具体应用的情况,需长时间经验的积累。
11) 怎样利用脚本自动关闭sybase数据库 http://www.chinaunix.net/cgi-bin/bbs/topic.cgi?forum=10&topic=1484&show=180 不知你什么平台,如果是unix,ksh #!/bin/ksh LOGIN="`whoami`" if [ "${LOGIN}" != "sybase" ]; then echo "`basename $0`: You should login as 'sybase'\n" exit 0 fi echo "\n\n" { isql -Usa -P -Syourservername > /dev/null 2>&1 <<ISQL use master go shutdown SYB_BACKUP go shutdown go ISQL }
12) 请教存储过程动态使用表 http://www.chinaunix.net/cgi-bin/bbs/topic.cgi?forum=10&topic=1488&show=180 你指动态sql 要12.0版本以上才支持 CREATE PROCEDURE dbo.mytt (@c varchar(25)) AS BEGIN declare @cc varchar(25) select @cc = "select * from " + @c exec (@cc) END