sybase

Sybase系统崩溃了,没有备份,但设备文件还存在,如何恢复数据库?

我们两清 提交于 2019-12-01 07:45:03
  情况一、所有设备,包括 master ,均是完整的:   这种情况是最简单的,只需要先备份设备文件(包括 master , copy 到安全的地方),然后重新安装系统,建服务(保持页面大小、编码和排序与以前一样),然后停止服务,按原目录将所有设备文件拷贝回来,再重启服务即可。新建的服务名可与旧服务不同。建议把 服务名 .cfg 也复制过来,省掉参数配置。    情况二、应用的设备是完整的,但没有 master 了: 方法一、 这种情况下要恢复数据库就需要原来的设备使用情况表了。重新安装系统,建服务,然后按原设备情况建设备(大小、位置保持和原来一致),接下来根据记录下来的设备使用情况建库,顺序以及占用的空间要和以前的一致。然后停服务,将应用的数据库设备复制回来,重启服务即可。请参考 Sybase ASE 系统管理员日常维护指南的建议,定期备份 master 数据库。 方法二、 1. 重新创建 master 设备 本实验描述了如何在 master 数据库毁坏的情况下,如何重建主设备,恢复 master 数据库,得以重新恢复系统。 这里假定: l Master 数据库已损坏,或主设备已损坏。 l 有系统表的最新打印输出。 l 主设备只包括 master 数据库、 tempdb 和 model l 有 master 数据库的最新备份,且上次转储 master

维护sybase数据库的DBA必须掌握的命令

拥有回忆 提交于 2019-12-01 07:44:41
1、dump命令 这是sybase数据库中常用的备份命令,格式为 dump database QJMIS to “z:\qjmis20040324” 命令的含义是把用户数据库QJMIS备份到z盘的根目录下,备份文件名为qjmis20040324,在为备份文件命名的时候,最好加上日期,这样在恢复时能够很快找到该文件。QJMIS是我们本文中所用的用户数据库的名称。 此命令也可以备份master数据库,方法一样,master数据库的备份和用户数据库的备份同样重要,因为如果master 数据库遭损坏,数据库服务将无法启动,此时若有备份过的master数据库,恢复就会简单得多。 2、load命令 这是sybase数据库中常用的恢复命令,格式为 load database QJMIS from “z: \qjmis20040324” 命令含义是把备份数据库文件qjmis20040324恢复到QJMIS库里,做完此操作后,必须用online命令使该数据库处于在线状态,即online database QJMIS。对于普通的用户数据库,在多用户模式下也可以进行恢复工作,但在恢复时要保证除系统管理员外没有其他用户使用此数据库。对于master数据库,却要在单用户模式下才能用此命令进行装载。那如何进入单用户模式呢? 编辑处于Adaptive SERVER install目录中的RUN

Pivoting in Sybase SQL Query?

[亡魂溺海] 提交于 2019-12-01 07:07:41
问题 I am looking for a way to pivot the following results... ID | Group_Level | Group_Values 1 | Division | Value 1 2 | Department | Value 2 3 | Class | Value 3 Into the following structure.... ID | Division | Department | Class 1 | Value 1 | Value 2 | Value 3 2 | Value 1 | Value 2 | Value 3 The number of columns is fixed (it will always be division/department/class). The query is intended for Sybase... have been unable to figure out how to achieve this sort of pivoting yet. Any advice? 回答1: You

How to Get The Count or The Number Of Rows In A Result Set In PHP using ODBC Connection?

自作多情 提交于 2019-12-01 04:16:39
问题 While I build a web page in My PHP web application, My Connection works ok but When I want to get the count of rows of the SELECT Statement I used in my query, It gives me -1 !! although my result set has about 10 rows. I would like to get the actual number of result set rows. I searched the PHP Manual & documentation but I do not find a direct way like a Count function or something like that. I wonder if I have to make a Count(*) SQL Statement in another query and attach it to my Connection

How do I execute different SELECT statements based on a CASE

心已入冬 提交于 2019-12-01 03:47:02
问题 I am facing a problem in executing queries with CASE statement. Based on my condition,(for eg. length), I want to execute different SQL statement. Problematic sample query is as follows: select case when char_length('19480821') = 8 then select count(1) from Patient when char_length('19480821')=10 then select count(1) from Doctor end Exception: [Error] Script lines: 1-5 -------------------------- Incorrect syntax near the keyword 'select'. Msg: 156, Level: 15, State: 2 Server: sunsrv4z7, Line:

How do I look at column metadata in Sybase?

六眼飞鱼酱① 提交于 2019-12-01 02:02:08
问题 I have a list of columns a co-worker has given to me, but these columns reside in different tables in the DB. Is there some kind of tool in Sybase where I can query the table a column belongs to? (I've tried Google-ing for this kind of tool, but no luck so far) 回答1: syscolumns holds column metadata. select * from syscolumns where name = ; The id column in syscolumns is the id of the column's table, in sysobjects; select b.name as tablename, a.name as columnname from syscolumns a join

JDBC collection(zz itpub)

蹲街弑〆低调 提交于 2019-12-01 00:18:32
为了自己JDBC 驱动 下载方便快捷,也便于网友的使用,特意把这些JDBC的驱动包下载汇总如下,。。。。说明:此内容来源于 网络 !。。。。。 Microsoft SQL Server (6.5, 7, 2000 and 2005) and Sybase (10, 11, 12). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ JDBC Name: jTDS Home Page: http://jtds.sourceforge.net/ JDBC Ver: 1.0.2 Download: http://sourceforge.net/project/showfiles.php?group_id=33291 Conn Code: Class.forName("net.sourceforge.jtds.jdbc.Driver "); Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://host:port/database","user","password"); or Connection con = DriverManager.getConnection("jdbc:jtds

How in JDBC can you call a stored procedure when only setting some parameters

☆樱花仙子☆ 提交于 2019-11-30 22:33:19
What is the best way to make a call to a stored procedure using JDBC if you only want to set some of the parameters? If I was just using SQL, I could set the paramerers by name in the SQL to call the sproc. E.g. if I have a stored procedure with nine parameters and I wanted to set parameters 1,2 and 9, leaving the rest to their default values, I can run this SQL: exec my_stored_procedure @parameter_1 = "ONE", @parameter_2 = "TWO", @parameter_9 = "NINE" Using JDBC (Specifically jConnect 6.0), it seems that when using a CallableStatement, you have to set the parameters by their integer index,

Sybase, execute string as sql query

痴心易碎 提交于 2019-11-30 20:12:20
In Sybase SQL, I would like to execute a String containing SQL. I would expect something like this to work declare @exec_str char(100) select @exec_str = "select 1" execute @exec_str go from the documentation of the exec command execute | exec is used to execute a stored procedure or an extended stored procedure (ESP). This keyword is necessary if there are multiple statements in the batch. execute is also used to execute a string containing Transact-SQL. However my above example gives an error. Am I doing something wrong? You need bracketing: execute ( @exec_str ) 来源: https://stackoverflow

How do I limit the amount of results returned in Sybase?

风流意气都作罢 提交于 2019-11-30 17:02:06
I need to query a Sybase database which has a lot of data in it, and would like to set a limit so the DB stops the query after 10 results. The key thing is performance, so it would be no use if it searched all results and then then returned the last 10 results. Thanks in advance I believe you can do a SET ROWCOUNT 10 first, then all queries in this session until a further SET ROWCOUNT will return no more than 10 rows. As a comment points out, this affects all following queries in the session (not just SELECT s!) until turned off (by setting to 0) or set differently -- this "global" effect