How To Recover Pubs?
Feb 2, 2006I am using sql server7.0
I want to know how to recover pubs and northwind data bases in case they are deleted.
Gajanan Kulkarni
I am using sql server7.0
I want to know how to recover pubs and northwind data bases in case they are deleted.
Gajanan Kulkarni
I have placed the pubs.mdf in the same folder as my asp page and have changed the connection string to : Dim ConnectionString As String = "server=(local);database=pubs.mdf;trusted_connection=true"
However, when I run this page, I get this message:
Server Error in '/' Application.
SQL Server does not exist or access denied.
What does the ConnectionString need to be for this to work?
Canning
http://msdn2.microsoft.com/en-us/library/aa238305(SQL.80).aspx
how can i List the title name, year of order, state and total quantity for all sales?
Some of solutions are below but not for the above question.
-- list the titles by total sales price.
select
title,
sum(s.qty * t.price)
from titles t
join sales s on (s.title_id = t.title_id)
group by title
order by 2 desc
-- list the titles by total sales qty
select
t.title,
sum(s.qty)
from titles t
join sales s on (s.title_id = t.title_id)
group by t.title
order by 2 desc
-- list the stores and titles by sales price.
select
st.stor_name,
t.title,
sum(s.qty * t.price)
from titles t
join sales s on (s.title_id = t.title_id)
join stores st on (s.stor_id = st.stor_id)
group by
st.stor_name,
t.title
order by 1,3 desc
This is how i List the titles and author names, in general sql, but i have no idea using cursor. So, can anyone help me to create a cursor that loops through the authors table.
select
au_lname,
au_fname,
title
from
authors a
join titleauthor ta on (a.au_id=ta.au_id)
join titles t on (ta.title_id=t.title_id)
below is the ddl for the three tables.
CREATE TABLE [dbo].[titleauthor](
[au_id] [dbo].[id] NOT NULL,
[title_id] [dbo].[tid] NOT NULL,
[au_ord] [tinyint] NULL,
[royaltyper] [int] NULL,
CONSTRAINT [UPKCL_taind] PRIMARY KEY CLUSTERED
(
[au_id] ASC,
[title_id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
ALTER TABLE [dbo].[titleauthor] WITH CHECK ADD FOREIGN KEY([au_id])
REFERENCES [dbo].[authors] ([au_id])
ALTER TABLE [dbo].[titleauthor] WITH CHECK ADD FOREIGN KEY([title_id])
REFERENCES [dbo].[titles] ([title_id])
CREATE TABLE [dbo].[titles](
[title_id] [dbo].[tid] NOT NULL,
[title] [varchar](80) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[type] [char](12) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT ('UNDECIDED'),
[pub_id] [char](4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[price] [money] NULL,
[advance] [money] NULL,
[royalty] [int] NULL,
[ytd_sales] [int] NULL,
[notes] [varchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[pubdate] [datetime] NOT NULL DEFAULT (getdate()),
CONSTRAINT [UPKCL_titleidind] PRIMARY KEY CLUSTERED
(
[title_id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
ALTER TABLE [dbo].[titles] WITH CHECK ADD FOREIGN KEY([pub_id])
REFERENCES [dbo].[publishers] ([pub_id])
CREATE TABLE [dbo].[authors](
[au_id] [dbo].[id] NOT NULL,
[au_lname] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[au_fname] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[phone] [char](12) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT ('UNKNOWN'),
[address] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[city] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[state] [char](2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[zip] [char](5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[contract] [bit] NOT NULL,
CONSTRAINT [UPKCL_auidind] PRIMARY KEY CLUSTERED
(
[au_id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
ALTER TABLE [dbo].[authors] WITH CHECK ADD CHECK (([au_id] like '[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]'))
GO
ALTER TABLE [dbo].[authors] WITH CHECK ADD CHECK (([zip] like '[0-9][0-9][0-9][0-9][0-9]'))
Need help.After I installed MSDE. I opened a command prompt and navigate to C:Program FilesMicrosoft Visual studio .NET 2003SDKv1.1SamplesSetupAnd then I typed in: oSpl -S(local)VSdotNET -E -i instpubs.sqlI got the message:[DBNETLIB]SQL Server does not exist or acdcess denied.[DENETLIB]ConnectionOpen (Connect()).How can I fix it?The server 2000 is running and it's mixed login authentication.OS: windows server 2003Thank you,William
View 5 Replies View RelatedHello:I am in the middle of an asp.net 1.1 book and I ran into a problem that I can not seem to find an answer for.I am able to build an asp.net web form in Visual Studio.net and I am able to connect to my local SQL Server that is running on the same computer through Visual Studio, but when I go into build and preview my page in the browser, I get the "Error reading the database. [DBNETLIB][ConnectionOpen(Connect()).] SQL Server does not exist or access denied." Has any one been able to connect to pubs locally, or can any one give me a suggestion to what I can try? Any help would be greatly appreciated.
View 5 Replies View RelatedHello,What are the default login/password to access pubs and northwind databases ?I remember the login = "sa", but nothing about the password.ThanksEric
View 4 Replies View RelatedI have just installed SQL Server 2005 Developer Edition and attached the Pubs database that is enabled for full-text searching and I have run full-text searches on it using Sql Server 2005 Express. When i tried to search, I was informed that the catalog was not in a stable condition. I ran this scriptDrop FullText Catalog PubsCatalogI got this message:Warning: The fulltext catalog 'PubsCatalog' is being dropped and is currently set as default.When I try to create a new PubsCatalog, I get:Msg 7689, Level 16, State 1, Line 1Execution of a full-text operation failed. 'The dependency service does not exist or has been marked for deletion.' I have tried other catalog names but the same result. This was easy to do with the same db in Sql Server 2005 Express. What is wrong and how do I fix it?
View 1 Replies View RelatedWhile checking the SQL server error logs, I notice that the pubs and msdb database are automatically being backed up, even though no job is set up to do so....in addition, its backing up to a directory that I cannot find on our network.....does anybody have an idea of whats going on ?
the path its backingup to is:
(FILE=1, TYPE=PIPE: {'.pipedbasql70dbagent0s0'}).
Thank you in advance
Hi all,
I have a stand-alone Windows XP Pro PC that has SQL Server Express (SSE) and Visual Web Developer Express (VWDE) programs. The Microsoft "pubs" Database is installed in the SQL Server Management Studio Express (SSMSE). I created a website in my VWDE program. I need the .mdf file of the pubs Database in the App_Data folder of website of my VWDE project. I think that User Instance in my SSE is established. I have studied Xcopy Deployment (SQL Server Express) and User Instance for a quite a while and I still do not know where and how to use Xcopy to get the mdf file of the pubs database into the App_Data folder of the website of my VWDE project. Please help and give me the detailed key steps/instructions about where and how to get the .mdf file of the pubs database into the App_Data folder of the website of my VWDE project via Xcopy.
Thanks in advance,
Scott Chang
Hi all,
I tried to use the "How to call a Parameterterized Stored Procedure by Using ADO.NET and Visual Basic.NET" in http://support.microsoft.com/kb/308049 to learn "Use DataReader to Return Rows and Parameter" in my VB 2005 Express. I did the following things:
1) created a stored procedure "pubsTestProc1.sql" in my SQL Server Management Studio Express (SSMSE):
USE pubs
GO
Create Procedure TestProcedure
(
@au_idIN varchar (11),
@numTitlesOUT Integer OUTPUT
)
As
select A.au_fname, A.au_lname, T.title
from authors as A join titleauthor as TA on
A.au_id=TA.au_id
join titles as T
on T.title_id=TA.title_id
where A.au_id=@au_idIN
set @numTitlesOUT = @@Rowcount
return (5)
2) created a project "pubsTestProc1.vb" in my VB 2005 Express and copied the following code from http://support.microsoft.com/kb/308049 (i.e. Added the code to the Form_Load eventQL_Client) :
Imports System.Data
Imports System.Data.Client
Imports System.Data.SqlType
Imports System.Data.Odbc
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim PubsConn As SqlConnection = New SqlConnection & _
("Data Source=.SQLEXPRESS;integrated security=sspi;" & _
"initial Catalog=pubs;")
Dim testCMD As SqlCommand = New SqlCommand & _
("TestProcedure", PubsConn)
testCMD.CommandType = CommandType.StoredProcedure
Dim RetValue As SqlParameter = testCMD.Parameters.Add & _
("RetValue", SqlDbType.Int)
RetValue.Direction = ParameterDirection.ReturnValue
Dim auIDIN As SqlParameter = testCMD.Parameters.Add & _
("@au_idIN", SqlDbType.VarChar, 11)
auIDIN.Direction = ParameterDirection.Input
Dim NumTitles As SqlParameter = testCMD.Parameters.Add & _
("@numtitlesout", SqlDbType.Int)
NumTitles.Direction = ParameterDirection.Output
auIDIN.Value = "213-46-8915"
PubsConn.Open()
Dim myReader As SqlDataReader = testCMD.ExecuteReader()
Console.WriteLine("Book Titles for this Author:")
Do While myReader.Read
Console.WriteLine("{0}", myReader.GetString(2))
Loop
myReader.Close()
Console.WriteLine("Return Value: " & (RetValue.Value))
Console.WriteLine("Number of Records: " & (NumTitles.Value))
End Sub
End Class
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I compiled the above code and I got the following 15 errors:
Warning 1 Namespace or type specified in the Imports 'System.Data.Client' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 2 9 pubsTestProc1
Warning 2 Namespace or type specified in the Imports 'System.Data.SqlType' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 3 9 pubsTestProc1
Error 3 Type 'SqlConnection' is not defined. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 10 25 pubsTestProc1
Error 4 ')' expected. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 15 30 pubsTestProc1
Error 5 Name 'testCMD' is not declared. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 17 9 pubsTestProc1
Error 6 ')' expected. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 20 23 pubsTestProc1
Error 7 Name 'RetValue' is not declared. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 21 9 pubsTestProc1
Error 8 ')' expected. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 23 23 pubsTestProc1
Error 9 Name 'auIDIN' is not declared. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 24 9 pubsTestProc1
Error 10 ')' expected. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 26 28 pubsTestProc1
Error 11 Name 'NumTitles' is not declared. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 27 9 pubsTestProc1
Error 12 Name 'auIDIN' is not declared. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 29 9 pubsTestProc1
Error 13 Type 'SqlDataReader' is not defined. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 32 25 pubsTestProc1
Error 14 Name 'RetValue' is not declared. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 39 47 pubsTestProc1
Error 15 Name 'NumTitles' is not declared. C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005ProjectspubsTestProc1pubsTestProc1Form1.vb 40 52 pubsTestProc1
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
First, I am completely lost here alreay. Second, I should have the following code from http://support.microsoft.com/kb/308049 too:
OLE DB Data Provider
Dim PubsConn As OleDbConnection = New OleDbConnection & _
("Provider=sqloledb;Data Source=server;" & _
"integrated security=sspi;initial Catalog=pubs;")
Dim testCMD As OleDbCommand = New OleDbCommand & _
("TestProcedure", PubsConn)
testCMD.CommandType = CommandType.StoredProcedure
Dim RetValue As OleDbParameter = testCMD.Parameters.Add & _
("RetValue", OleDbType.Integer)
RetValue.Direction = ParameterDirection.ReturnValue
Dim auIDIN As OleDbParameter = testCMD.Parameters.Add & _
("@au_idIN", OleDbType.VarChar, 11)
auIDIN.Direction = ParameterDirection.Input
Dim NumTitles As OleDbParameter = testCMD.Parameters.Add & _
("@numtitlesout", OleDbType.Integer)
NumTitles.Direction = ParameterDirection.Output
auIDIN.Value = "213-46-8915"
PubsConn.Open()
Dim myReader As OleDbDataReader = testCMD.ExecuteReader()
Console.WriteLine("Book Titles for this Author:")
Do While myReader.Read
Console.WriteLine("{0}", myReader.GetString(2))
Loop
myReader.Close()
Console.WriteLine("Return Value: " & (RetValue.Value))
Console.WriteLine("Number of Records: " & (NumTitles.Value))
//////////////////////////////////////////////////////////////////////////////////////////////////////
Now, I am completely out of touch with these two sets of the code from the Microsoft KB 308049 and do not know how to proceed to get the following output stated in the Microsoft KB 308049-see the below:
4.
Modify the connection string for the Connection object to point to the server that is running SQL Server.
5.
Run the code. Notice that the ExecuteScalar method of the Command object returns the parameters. ExecuteScalar also returns the value of column 1, row 1 of the returned rowset. Thus, the value of intCount is the result of the count function from the stored procedure.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Please help and tell me what I should do to get this project landed on the right track.
Thanks in advance,
Scott Chang
Is there a way to recover the database without defining a device to restore from?
Restore Database TestDB With Recovery
MTmace
Hi,
By mistake i've damaged my .mdf file and i have no backup on this database . However i have the transaction log intact and an older version of the database .
Is it possible to recover the database using the transaction log? How can it be done?
I do not have the transaction log backup, just the .ldf file.
Thanks to anyone who can help me.
1, I have installed VWD express,sql server 2005 express.I also install management studio and adventureswork db.In the management studio I can able to connect and view adventurework db.But I can't manage to make a connection string to my db server when connecting to management studio server name is "KAMRANSHAHIDSQLEXPRESS".I wants a connection string with respect to this server.2,Is there new database for pubs and northwind for sql server 2005.Or they are of old sql server 2000.I have installed sample databases but can't find script for pubs and northwind nor it install automatically.I wan't to use tutorial's sample.
View 1 Replies View RelatedHow do I begin? I had previously installed the SQL Server 7.0 with NT Authentication and everything was fine until I Rename domain Name and Computer name. I decided to uninstall SQL Server, and then reinstall it.
From this action unable to see my database in enterprise manager. I Rename old domain and computer name again. and reinstall with Upgrade Version. but still same effect. Can anyone help? What do I need to do to get my database to work again? Any input on this will be appreciated. Thanks in advance.
I had MS SQL installed on my comp.I had to reformat my hard drive due to some problems.There was a db in the sql server which i needed.So i saved the .mdf & .sdf files.Then i installed sql server in the formatted hard drive & pasted the .mdf & .ldf files in the Data forlder in MSSQL folder.But the problem is that even after doing this the enterprise manager doesnt show that database.Can anyone help me with this?Is there any way to recover the database?
Thanks a lot
P.S.- I also have whole of the earlier MSSQL folder present in the earlier program files backed up.Would that help in anyway.
Hello, everyone:
A guy think that the DTS packages can be recoved by restore MSDB database. Is that true? Does anyone have experience on that? Thanks.
ZYT
Hi
I've had a powerfailure, that resulted in I had to scratch my DB server, I've managed to get all the .mdf and .ldf files from the server. On the new server I get a "Error 823: I/O error (torn page)" when I'm trying to attach the .mdf file to the New server.
Both the new and the old server is a win2003 with SQL 2000 SP3
Is there anybody who knows how I can recover the DB?
/Rune
Hello,
Is it possible to restore a SQL 2000 database with data from a transaction log?
I am not sure what happened to my database, all the data in the tables is gone. I generated a db script to create a duplicate database. I saved the .sql file on my local machine, separate from the db server, renamed the database name in the .sql file to a new database. Tested script in query analyzer for syntax, all was fine. Running it at this point would have created a new database with a different name, right?
Now my original database is empty. Can someone please provide me with information on getting my data back. Is there a way of using the transaction log to recover the data.
Thanks
I have changed the roles of primary and secondary servers due to server failure.
Can anyone advise how to revert back to previous main server? Are these any links available?
Hi
I need help to recover database from its MDF & ldf files as my server crahsed today .
BTW i installed afresh copy of MS SQL 7.0
I need to be able to restore the database. Pls reply if
you can help. It would be greatly appreciated.
:( :confused:
is there any way to recover a database? I accidently drop my database .I don't have any backup.
View 5 Replies View RelatedPaul,
Having read your useful insight into the sorts of issues around the corruptions that folk have posted in this forum I'm interested in preparing for the day when one of our servers gets corrupted :-(
Should I expect to be able to:
Restore FULL backup from Before the corruption first happened
Restore all Tranaction log backups since
and would get me back to ground zero?
I'm thinking:
if I do a DBCC CHECKDB once a week, say, immediately after a FULL backup - then if that gives me some error messages I've got last weeks Full backup and a weeks worth of Trans Log Backups to restore - which is OK for a rare disaster.
I apprecaite that the thing that caused the corruption might be a memory or disk fault, which might also have broken the creation of the backup files too - in which case I'm fairly stuffed!
Does a RESTORE do a checksum of somesort that would detect a corruption caused by, say, a memory fault or a disk controller that wrote the block faultily [twiddled some bits, but did not report error]?
In which case continuous restores of backup files to A.N.Other server would discover the moment at which a backup was "known bad"
Am I close?
Thanks
Kristen
raju writes "while attaching the mdf file we are getting the following error
error 823
i/o error (bad page id) detected during read at offset
0x0000001404000 in file d:filename"
OS: Windows 2003 Standard Edition
MS SQL: Standard Server 2005
I am looking to implement a disaster recovery plan for an MS SQL 2005 server, this is what I have done so far but would like the benefit of your experience to provide feedback and help improve the strategy.
MS SQL Server:
I have two maintenance plans, one to backup the system databases to individual backup files (.bak) and one to backup all the user databases to a backup device (mssql_backup) The backup files & device are in a directory (backup) and is backed up using NFS. I keep a copy of the backups on a USB HD which is stored offsite.
Disaster:
Office burnt down
Recovery:
New server, install OS/MSSQL, patch up to same version as burnt server.
Copy .bak files to new server, copy mssql_backup file to same location as previously held i.e. X:ackupmssql_backup
Start MS SQL in single user mode, restore master database using .bak.
Start MS SQL in normal mode, restore other system databases using .bak
Restore user databases using mssql_backup device
Testing:
Using the above steps I was able to restore up to the point of "user databases" Getting to this point I realised that there are a number of databases to restore, in my novice ways this seems to be a lot of right-clicking and restoring.
1) is there a command that would in effect be able to restore all databases using the backup device?
2) do I have a working version of the databases to the point of the last backup? Or am I missing something?
3) in my current setup in mind (SQL backup to NFS directory and picked up my backup software) is there a 'better' way I could be doing this which would make the restoration procedure more efficient
how can i recover sqlserver 6.5 datbase from tape.
pls help me?
Hi,
View 12 Replies View RelatedHi all,
Is it possible to recover or find the password of database or resetting is the only option? I have a database that has a two users in the Users tab. How to find out the password for these?
Thanks,
Hi,
By mistake i've damaged my .mdf file and i have no backup on this database . However i have the transaction log intact and an older version of the database .
Is it possible to recover the database using the transaction log? How can it be done?
Thanks to anyone who can help me.
Hi,
Some times my laptop will hang for some reason and i will have open few sql 2005 query editors working with scripts. I am loosing them if i restart my system. Is there any way to recover the previous instance of my sql 2005 query editors after restarting my system. Please let me know if yo have any idea to handle.
Thanks
Dilip
Hi All,
Accidentally I have dropped a table and that is the main table for my application.
I dont have a backup of it. Is there any way to recover it.Please help me guys.
Thanks,
Kumar.
Hello,
I have some procedure in SQL Server 7.3 they are
working fine. Now my SQL Server is not working that is
it not opening Query Analizer or any other tool
in SQL Server ok.
I have no back of my procedures which are written
in SQL Server any where like in notepad or in some
places.
Now i have a plan to load Sql server again
but i want my old procedures before loading
Sql Server again.
How to do it?
How to restore my procedures?
Where actually SQL Server stores these procedures?
I searched in my system with my procedure name but it
shows nothing with those names.
In my case there is no chance of recovering my old SQL Server
i have load again SQL Server.
So kindly help on this issue asap.
thanks
One of our developers just deleted a ton of records- is there any way we can recover this data? (we can't use a backup since a ton of changes were made since we last backed up)
Thanks-
Jack