Showing posts with label alli. Show all posts
Showing posts with label alli. Show all posts

Thursday, March 22, 2012

does restore operation break tlog bckup chain?

Hi all!
I'm thinking of switching my production db to full recovery model.
Now, I've some questions regarding tlog backups chain. What can
possibly break chain of transaction log backups?
And yet another question. Does restore operation break transaction log
backups chain? I mean, should every restore operation be followed by
full db backup?
with regards
Maciej Szymanski> What can possibly break chain of transaction log backups?
In the FULL recovery model, truncating the log without creating a log backup
file (BACKUP LOG WITH TRUNCATE_ONLY or NO_LOG) will break the log backup
sequence.
quote:

> And yet another question. Does restore operation break transaction log
> backups chain? I mean, should every restore operation be followed by
> full db backup?

The script below illustrates that a backup isn't needed following a restore.
CREATE DATABASE MyDatabase
ALTER DATABASE MyDatabase
SET RECOVERY FULL
GO
USE MyDatabase
CREATE TABLE MyTable(Col1 int NOT NULL)
INSERT INTO MyTable VALUES(1)
BACKUP DATABASE MyDatabase
TO DISK='C:\Backups\MyDatabase.bak'
WITH INIT
INSERT INTO MyTable VALUES(2)
BACKUP LOG MyDatabase
TO DISK='C:\Backups\MyDatabase_Log1.bak'
WITH INIT
GO
USE master
RESTORE DATABASE MyDatabase
FROM DISK='C:\Backups\MyDatabase.bak'
WITH NORECOVERY
RESTORE LOG MyDatabase
FROM DISK='C:\Backups\MyDatabase_Log1.bak'
WITH RECOVERY
GO
USE MyDatabase
INSERT INTO MyTable VALUES(3)
BACKUP LOG MyDatabase
TO DISK='C:\Backups\MyDatabase_Log2.bak'
WITH INIT
GO
USE master
RESTORE DATABASE MyDatabase
FROM DISK='C:\Backups\MyDatabase.bak'
WITH NORECOVERY
RESTORE LOG MyDatabase
FROM DISK='C:\Backups\MyDatabase_Log1.bak'
WITH NORECOVERY
RESTORE LOG MyDatabase
FROM DISK='C:\Backups\MyDatabase_Log2.bak'
WITH RECOVERY
GO
USE MyDatabase
SELECT * FROM MyTable -- 3 rows returned
Hope this helps.
Dan Guzman
SQL Server MVP
"Maciej Szymanski" <maciek@.kolobrzeg.com.pl> wrote in message
news:85a5f2.0401170757.4de3ca20@.posting.google.com...
quote:

> Hi all!
> I'm thinking of switching my production db to full recovery model.
> Now, I've some questions regarding tlog backups chain. What can
> possibly break chain of transaction log backups?
> And yet another question. Does restore operation break transaction log
> backups chain? I mean, should every restore operation be followed by
> full db backup?
> with regards
> Maciej Szymanski

Friday, February 24, 2012

Does a FK constraint create an index?

(SQL Server 2000, SP3a)
Hello all!
I was wondering if a foreign key constraint will create an index like a prim
ary key
constraint?
Thanks!
John PetersonNope.
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:eG2RnlF3DHA.1720@.TK2MSFTNGP10.phx.gbl...
(SQL Server 2000, SP3a)
Hello all!
I was wondering if a foreign key constraint will create an index like a
primary key
constraint?
Thanks!
John Peterson|||Nope, you'll have to build one yourself.
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:eG2RnlF3DHA.1720@.TK2MSFTNGP10.phx.gbl...
quote:

> (SQL Server 2000, SP3a)
> Hello all!
> I was wondering if a foreign key constraint will create an index like a

primary key
quote:

> constraint?
> Thanks!
> John Peterson
>
|||Thanks Tom/Kalen! That's what I thought -- but wanted to double-check, as t
he CREATE
TABLE entry in BOL wasn't wholly specific on whether an index was created in
the PK
context (though, it alludes to it later), and I thought maybe the FK descrip
tion was
potentially similarly vague.
Thanks again!
John Peterson
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:eG2RnlF3DHA.1720@.TK2MSFTNGP10.phx.gbl...
quote:

> (SQL Server 2000, SP3a)
> Hello all!
> I was wondering if a foreign key constraint will create an index like a pr
imary key
> constraint?
> Thanks!
> John Peterson
>

Sunday, February 19, 2012

Documentation of the Tables in SQL Server

Hi all
I have 15 tables in my database and I want to create a pdf file with description about all the columns of these tables(Data Model)
Few questions
How can I get all the column names in the excel or pdf file?
Is there any tool which can give me the output template for these columns and then I just have to fill the description for each column?
ThanksYou can query the Information _Schema tables to get a listing of tables and their columns.|||Did you ask your dba?|||Did you ask your dba?

Better yet ... did you buy your dba lunch?|||My preference would be to create a script that will create the tables (complete with constraints, etc) and then comment that script liberally. You can use Visual Studio, SQL Enterprise Mangler, or SQL-DMO to make the script if you don't already have one.

Once you've done this, check the fully commented script into source code control too!

-PatP|||Thanks guys for the responses
Here I am talking about an already built system and I am trying to document the database|||You can look on Red Gate i think they have a tool for that|||You can look on Red Gate i think they have a tool for that

so do I, and it's better than redgate's. see the link in my sig. :)|||Thanks
I wish there was any free/open source solution!|||Pat's solution (post #5) is free. I have a binder on my desk that's full of well commented "script" files of all my table definitions. Columns, indexes, triggers, etc. Every time I change a table, I regenerate the script and put new comments in. The extra 5 minutes is worth the effort.|||I don't consider a pile of commented source files as documentation. Would the the source code to SQL Server (heavily commented) tell you how to use it? Not really.

There are some free ones out there (but you get what you pay for). for example:

http://www.codeplex.com/datadictionary