Showing posts with label backup. Show all posts
Showing posts with label backup. Show all posts

Tuesday, March 27, 2012

Count is different on same table? Datetime column error?

Hi,
I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
server. A Full Backup of the db (prototype) was taken from SV1 was
applied to SV2. One of the tables in the database has over 40 million
rows in it. My task is to keep any rows no older than 18 months.
SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
this is correct as SV1 is constantly in use, so SV2 will always be a
day or two behind. The issue arrises when I perform my count on both
servers, when I run the following on SV1:
select count(*) from tblConsignments
where [Date] >= '2003-08-01 00:00:00.000'
the count is approx 25,500,000 rows, however when I run the exact same
statement on SV2 the count is 19,500,000. Why would there be a
discrepancy of 6,000,000? The collation is the same for both servers
(SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
standard, both SP3a).
When I do a count year by year (on both servers) it comes to aprrox.
35,000,000 however the total for the tblConsignments is 42million.
Possibly the answer would be to check the data more throughly, however
I would like to know if Datetime columns can be set to different
versions?
Thanks
qh
Have you broken the data into smaller chunks? E.g. maybe a week or a month
is missing on one server...
This is my signature. It is a general reminder.
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
news:1115224865.478078.231810@.o13g2000cwo.googlegr oups.com...
> Hi,
> I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
> server. A Full Backup of the db (prototype) was taken from SV1 was
> applied to SV2. One of the tables in the database has over 40 million
> rows in it. My task is to keep any rows no older than 18 months.
> SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
> SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
> this is correct as SV1 is constantly in use, so SV2 will always be a
> day or two behind. The issue arrises when I perform my count on both
> servers, when I run the following on SV1:
> select count(*) from tblConsignments
> where [Date] >= '2003-08-01 00:00:00.000'
> the count is approx 25,500,000 rows, however when I run the exact same
> statement on SV2 the count is 19,500,000. Why would there be a
> discrepancy of 6,000,000? The collation is the same for both servers
> (SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
> standard, both SP3a).
> When I do a count year by year (on both servers) it comes to aprrox.
> 35,000,000 however the total for the tblConsignments is 42million.
> Possibly the answer would be to check the data more throughly, however
> I would like to know if Datetime columns can be set to different
> versions?
> Thanks
> qh
>
|||Whenever you perform a COUNT(*), I'd recommend you use a MAXDOP (1) in
the SELECT to make sure the parallelism "issue" doesn't cause the
rowcount to be off.
David Gugick
Imceda Software
www.imceda.com
|||Hi,
Can you update the statistics and see.
UPDATE STATISTICS <TABLE NAME>
Otherwise execute the below command in both databases replacing count(*)
with *, but you need more space in ur hard disk on both servers
select * into old_records from tblConsignments where [Date] >= '2003-08-01
00:00:00.000'
Once the statement is completed try
select count(*) from old_records
But first try updating the statistics and see the difference.
Thanks
Hari
SQL Server MVP
"Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
news:1115224865.478078.231810@.o13g2000cwo.googlegr oups.com...
> Hi,
> I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
> server. A Full Backup of the db (prototype) was taken from SV1 was
> applied to SV2. One of the tables in the database has over 40 million
> rows in it. My task is to keep any rows no older than 18 months.
> SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
> SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
> this is correct as SV1 is constantly in use, so SV2 will always be a
> day or two behind. The issue arrises when I perform my count on both
> servers, when I run the following on SV1:
> select count(*) from tblConsignments
> where [Date] >= '2003-08-01 00:00:00.000'
> the count is approx 25,500,000 rows, however when I run the exact same
> statement on SV2 the count is 19,500,000. Why would there be a
> discrepancy of 6,000,000? The collation is the same for both servers
> (SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
> standard, both SP3a).
> When I do a count year by year (on both servers) it comes to aprrox.
> 35,000,000 however the total for the tblConsignments is 42million.
> Possibly the answer would be to check the data more throughly, however
> I would like to know if Datetime columns can be set to different
> versions?
> Thanks
> qh
>
|||Hari,
Just for the record, the date string you give will be
interpreted as August 1, 2003 in some cases (such as us_english language
settings),
and as January 8, 2003 in others (such as french language setting). The two
SQL Server safe formats to use are (for August 1) '20030801' and
'2003-08-01T00:00:00.000'
Steve Kass
Drew University
Hari Prasad wrote:

>Hi,
>Can you update the statistics and see.
>UPDATE STATISTICS <TABLE NAME>
>Otherwise execute the below command in both databases replacing count(*)
>with *, but you need more space in ur hard disk on both servers
>select * into old_records from tblConsignments where [Date] >= '2003-08-01
>00:00:00.000'
>Once the statement is completed try
>select count(*) from old_records
>
>But first try updating the statistics and see the difference.
>Thanks
>Hari
>SQL Server MVP
>
>"Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
>news:1115224865.478078.231810@.o13g2000cwo.googleg roups.com...
>
>
>
|||Hi ,
Update Statistics is used for statistics generation which is used for
determining the cost of the query , not sure how this will affect count(*) ,
please let me know if update statistics has any thing to do with count(*).
Regards
Vishal
"Hari Prasad" wrote:

> Hi,
> Can you update the statistics and see.
> UPDATE STATISTICS <TABLE NAME>
> Otherwise execute the below command in both databases replacing count(*)
> with *, but you need more space in ur hard disk on both servers
> select * into old_records from tblConsignments where [Date] >= '2003-08-01
> 00:00:00.000'
> Once the statement is completed try
> select count(*) from old_records
>
> But first try updating the statistics and see the difference.
> Thanks
> Hari
> SQL Server MVP
>
> "Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
> news:1115224865.478078.231810@.o13g2000cwo.googlegr oups.com...
>
>
|||Hi ,
Update Statistics is used for statistics generation which is used for
determining the cost of the query and selecting the appropriate index , not
sure how this will affect count(*) , please let me know if update statistics
has any thing to do with count(*).
Regards
Vishal

Count is different on same table? Datetime column error?

Hi,
I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
server. A Full Backup of the db (prototype) was taken from SV1 was
applied to SV2. One of the tables in the database has over 40 million
rows in it. My task is to keep any rows no older than 18 months.
SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
this is correct as SV1 is constantly in use, so SV2 will always be a
day or two behind. The issue arrises when I perform my count on both
servers, when I run the following on SV1:
select count(*) from tblConsignments
where [Date] >= '2003-08-01 00:00:00.000'
the count is approx 25,500,000 rows, however when I run the exact same
statement on SV2 the count is 19,500,000. Why would there be a
discrepancy of 6,000,000? The collation is the same for both servers
(SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
standard, both SP3a).
When I do a count year by year (on both servers) it comes to aprrox.
35,000,000 however the total for the tblConsignments is 42million.
Possibly the answer would be to check the data more throughly, however
I would like to know if Datetime columns can be set to different
versions?
Thanks
qhHave you broken the data into smaller chunks? E.g. maybe a week or a month
is missing on one server...
--
This is my signature. It is a general reminder.
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
news:1115224865.478078.231810@.o13g2000cwo.googlegroups.com...
> Hi,
> I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
> server. A Full Backup of the db (prototype) was taken from SV1 was
> applied to SV2. One of the tables in the database has over 40 million
> rows in it. My task is to keep any rows no older than 18 months.
> SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
> SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
> this is correct as SV1 is constantly in use, so SV2 will always be a
> day or two behind. The issue arrises when I perform my count on both
> servers, when I run the following on SV1:
> select count(*) from tblConsignments
> where [Date] >= '2003-08-01 00:00:00.000'
> the count is approx 25,500,000 rows, however when I run the exact same
> statement on SV2 the count is 19,500,000. Why would there be a
> discrepancy of 6,000,000? The collation is the same for both servers
> (SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
> standard, both SP3a).
> When I do a count year by year (on both servers) it comes to aprrox.
> 35,000,000 however the total for the tblConsignments is 42million.
> Possibly the answer would be to check the data more throughly, however
> I would like to know if Datetime columns can be set to different
> versions?
> Thanks
> qh
>|||Whenever you perform a COUNT(*), I'd recommend you use a MAXDOP (1) in
the SELECT to make sure the parallelism "issue" doesn't cause the
rowcount to be off.
--
David Gugick
Imceda Software
www.imceda.com|||Hi,
Can you update the statistics and see.
UPDATE STATISTICS <TABLE NAME>
Otherwise execute the below command in both databases replacing count(*)
with *, but you need more space in ur hard disk on both servers
select * into old_records from tblConsignments where [Date] >= '2003-08-01
00:00:00.000'
Once the statement is completed try
select count(*) from old_records
But first try updating the statistics and see the difference.
Thanks
Hari
SQL Server MVP
"Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
news:1115224865.478078.231810@.o13g2000cwo.googlegroups.com...
> Hi,
> I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
> server. A Full Backup of the db (prototype) was taken from SV1 was
> applied to SV2. One of the tables in the database has over 40 million
> rows in it. My task is to keep any rows no older than 18 months.
> SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
> SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
> this is correct as SV1 is constantly in use, so SV2 will always be a
> day or two behind. The issue arrises when I perform my count on both
> servers, when I run the following on SV1:
> select count(*) from tblConsignments
> where [Date] >= '2003-08-01 00:00:00.000'
> the count is approx 25,500,000 rows, however when I run the exact same
> statement on SV2 the count is 19,500,000. Why would there be a
> discrepancy of 6,000,000? The collation is the same for both servers
> (SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
> standard, both SP3a).
> When I do a count year by year (on both servers) it comes to aprrox.
> 35,000,000 however the total for the tblConsignments is 42million.
> Possibly the answer would be to check the data more throughly, however
> I would like to know if Datetime columns can be set to different
> versions?
> Thanks
> qh
>|||Hari,
Just for the record, the date string you give will be
interpreted as August 1, 2003 in some cases (such as us_english language
settings),
and as January 8, 2003 in others (such as french language setting). The two
SQL Server safe formats to use are (for August 1) '20030801' and
'2003-08-01T00:00:00.000'
Steve Kass
Drew University
Hari Prasad wrote:
>Hi,
>Can you update the statistics and see.
>UPDATE STATISTICS <TABLE NAME>
>Otherwise execute the below command in both databases replacing count(*)
>with *, but you need more space in ur hard disk on both servers
>select * into old_records from tblConsignments where [Date] >= '2003-08-01
>00:00:00.000'
>Once the statement is completed try
>select count(*) from old_records
>
>But first try updating the statistics and see the difference.
>Thanks
>Hari
>SQL Server MVP
>
>"Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
>news:1115224865.478078.231810@.o13g2000cwo.googlegroups.com...
>
>>Hi,
>>I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
>>server. A Full Backup of the db (prototype) was taken from SV1 was
>>applied to SV2. One of the tables in the database has over 40 million
>>rows in it. My task is to keep any rows no older than 18 months.
>>SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
>>SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
>>this is correct as SV1 is constantly in use, so SV2 will always be a
>>day or two behind. The issue arrises when I perform my count on both
>>servers, when I run the following on SV1:
>>select count(*) from tblConsignments
>>where [Date] >= '2003-08-01 00:00:00.000'
>>the count is approx 25,500,000 rows, however when I run the exact same
>>statement on SV2 the count is 19,500,000. Why would there be a
>>discrepancy of 6,000,000? The collation is the same for both servers
>>(SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
>>standard, both SP3a).
>>When I do a count year by year (on both servers) it comes to aprrox.
>>35,000,000 however the total for the tblConsignments is 42million.
>>Possibly the answer would be to check the data more throughly, however
>>I would like to know if Datetime columns can be set to different
>>versions?
>>Thanks
>>qh
>>
>
>|||Hi ,
Update Statistics is used for statistics generation which is used for
determining the cost of the query , not sure how this will affect count(*) ,
please let me know if update statistics has any thing to do with count(*).
Regards
Vishal
"Hari Prasad" wrote:
> Hi,
> Can you update the statistics and see.
> UPDATE STATISTICS <TABLE NAME>
> Otherwise execute the below command in both databases replacing count(*)
> with *, but you need more space in ur hard disk on both servers
> select * into old_records from tblConsignments where [Date] >= '2003-08-01
> 00:00:00.000'
> Once the statement is completed try
> select count(*) from old_records
>
> But first try updating the statistics and see the difference.
> Thanks
> Hari
> SQL Server MVP
>
> "Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
> news:1115224865.478078.231810@.o13g2000cwo.googlegroups.com...
> > Hi,
> >
> > I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
> > server. A Full Backup of the db (prototype) was taken from SV1 was
> > applied to SV2. One of the tables in the database has over 40 million
> > rows in it. My task is to keep any rows no older than 18 months.
> >
> > SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
> > SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
> >
> > this is correct as SV1 is constantly in use, so SV2 will always be a
> > day or two behind. The issue arrises when I perform my count on both
> > servers, when I run the following on SV1:
> >
> > select count(*) from tblConsignments
> > where [Date] >= '2003-08-01 00:00:00.000'
> >
> > the count is approx 25,500,000 rows, however when I run the exact same
> > statement on SV2 the count is 19,500,000. Why would there be a
> > discrepancy of 6,000,000? The collation is the same for both servers
> > (SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
> > standard, both SP3a).
> >
> > When I do a count year by year (on both servers) it comes to aprrox.
> > 35,000,000 however the total for the tblConsignments is 42million.
> > Possibly the answer would be to check the data more throughly, however
> > I would like to know if Datetime columns can be set to different
> > versions?
> >
> > Thanks
> >
> > qh
> >
>
>|||Hi ,
Update Statistics is used for statistics generation which is used for
determining the cost of the query and selecting the appropriate index , not
sure how this will affect count(*) , please let me know if update statistics
has any thing to do with count(*).
Regards
Vishal|||Hi Guys,
many thanks for the replies, I have taken your suggestions and tried
both UPDATE STATISTICS and the OPTION (MAXDOP 1) however I am still
returning the same rowcount anomoly. The main thing that has me
stumped is that the db on SV2 is a backup from the db on SV1!! I have
even created a small table based on a rowcount between certain years.
SV1 SV2
older 6,486,356 6,486,356
2002 9,893,118 9,893,118
2003 10,402,588 10,402,588
2004 11,268,420 11,268,419
2005+ 4,014,450 3,862,644
Totals 35,578,576 35,426,769
However as I originally mentioned there is over 41,000,000 rows in both
the corresponding tables? My next plan is to perform a simple data
complare on each table.
Thanks again
qhsql

Count is different on same table? Datetime column error?

Hi,
I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
server. A Full Backup of the db (prototype) was taken from SV1 was
applied to SV2. One of the tables in the database has over 40 million
rows in it. My task is to keep any rows no older than 18 months.
SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
this is correct as SV1 is constantly in use, so SV2 will always be a
day or two behind. The issue arrises when I perform my count on both
servers, when I run the following on SV1:
select count(*) from tblConsignments
where [Date] >= '2003-08-01 00:00:00.000'
the count is approx 25,500,000 rows, however when I run the exact same
statement on SV2 the count is 19,500,000. Why would there be a
discrepancy of 6,000,000? The collation is the same for both servers
(SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
standard, both SP3a).
When I do a count year by year (on both servers) it comes to aprrox.
35,000,000 however the total for the tblConsignments is 42million.
Possibly the answer would be to check the data more throughly, however
I would like to know if Datetime columns can be set to different
versions?
Thanks
qhHave you broken the data into smaller chunks? E.g. maybe a week or a month
is missing on one server...
This is my signature. It is a general reminder.
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
news:1115224865.478078.231810@.o13g2000cwo.googlegroups.com...
> Hi,
> I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
> server. A Full Backup of the db (prototype) was taken from SV1 was
> applied to SV2. One of the tables in the database has over 40 million
> rows in it. My task is to keep any rows no older than 18 months.
> SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
> SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
> this is correct as SV1 is constantly in use, so SV2 will always be a
> day or two behind. The issue arrises when I perform my count on both
> servers, when I run the following on SV1:
> select count(*) from tblConsignments
> where [Date] >= '2003-08-01 00:00:00.000'
> the count is approx 25,500,000 rows, however when I run the exact same
> statement on SV2 the count is 19,500,000. Why would there be a
> discrepancy of 6,000,000? The collation is the same for both servers
> (SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
> standard, both SP3a).
> When I do a count year by year (on both servers) it comes to aprrox.
> 35,000,000 however the total for the tblConsignments is 42million.
> Possibly the answer would be to check the data more throughly, however
> I would like to know if Datetime columns can be set to different
> versions?
> Thanks
> qh
>|||Whenever you perform a COUNT(*), I'd recommend you use a MAXDOP (1) in
the SELECT to make sure the parallelism "issue" doesn't cause the
rowcount to be off.
David Gugick
Imceda Software
www.imceda.com|||Hi,
Can you update the statistics and see.
UPDATE STATISTICS <TABLE NAME>
Otherwise execute the below command in both databases replacing count(*)
with *, but you need more space in ur hard disk on both servers
select * into old_records from tblConsignments where [Date] >= '2003-08-
01
00:00:00.000'
Once the statement is completed try
select count(*) from old_records
But first try updating the statistics and see the difference.
Thanks
Hari
SQL Server MVP
"Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
news:1115224865.478078.231810@.o13g2000cwo.googlegroups.com...
> Hi,
> I have two servers, SV1 is a 24/7 OLTP server and SV2 is a backup
> server. A Full Backup of the db (prototype) was taken from SV1 was
> applied to SV2. One of the tables in the database has over 40 million
> rows in it. My task is to keep any rows no older than 18 months.
> SV1.Prototype.dbo.tblConsignment approx. 42,000,000 rows
> SV2.Prototype.dbo.tblConsignment approx. 41,800,000 rows
> this is correct as SV1 is constantly in use, so SV2 will always be a
> day or two behind. The issue arrises when I perform my count on both
> servers, when I run the following on SV1:
> select count(*) from tblConsignments
> where [Date] >= '2003-08-01 00:00:00.000'
> the count is approx 25,500,000 rows, however when I run the exact same
> statement on SV2 the count is 19,500,000. Why would there be a
> discrepancy of 6,000,000? The collation is the same for both servers
> (SV2 is a higher spec server, SV1 is 2K enterprise editions, SV2 2k
> standard, both SP3a).
> When I do a count year by year (on both servers) it comes to aprrox.
> 35,000,000 however the total for the tblConsignments is 42million.
> Possibly the answer would be to check the data more throughly, however
> I would like to know if Datetime columns can be set to different
> versions?
> Thanks
> qh
>|||Hari,
Just for the record, the date string you give will be
interpreted as August 1, 2003 in some cases (such as us_english language
settings),
and as January 8, 2003 in others (such as french language setting). The two
SQL Server safe formats to use are (for August 1) '20030801' and
'2003-08-01T00:00:00.000'
Steve Kass
Drew University
Hari Prasad wrote:

>Hi,
>Can you update the statistics and see.
>UPDATE STATISTICS <TABLE NAME>
>Otherwise execute the below command in both databases replacing count(*)
>with *, but you need more space in ur hard disk on both servers
>select * into old_records from tblConsignments where [Date] >= '2003-08
-01
>00:00:00.000'
>Once the statement is completed try
>select count(*) from old_records
>
>But first try updating the statistics and see the difference.
>Thanks
>Hari
>SQL Server MVP
>
>"Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
>news:1115224865.478078.231810@.o13g2000cwo.googlegroups.com...
>
>
>|||Hi ,
Update Statistics is used for statistics generation which is used for
determining the cost of the query , not sure how this will affect count(*)
,
please let me know if update statistics has any thing to do with count(*).
Regards
Vishal
"Hari Prasad" wrote:

> Hi,
> Can you update the statistics and see.
> UPDATE STATISTICS <TABLE NAME>
> Otherwise execute the below command in both databases replacing count(*)
> with *, but you need more space in ur hard disk on both servers
> select * into old_records from tblConsignments where [Date] >= '2003-0
8-01
> 00:00:00.000'
> Once the statement is completed try
> select count(*) from old_records
>
> But first try updating the statistics and see the difference.
> Thanks
> Hari
> SQL Server MVP
>
> "Scott" <quackhandle1975@.yahoo.co.uk> wrote in message
> news:1115224865.478078.231810@.o13g2000cwo.googlegroups.com...
>
>|||Hi ,
Update Statistics is used for statistics generation which is used for
determining the cost of the query and selecting the appropriate index , not
sure how this will affect count(*) , please let me know if update statistic
s
has any thing to do with count(*).
Regards
Vishal

Tuesday, March 20, 2012

Could this be run using OSQL script

If there a way to detect if backup fails? I like to add better error
handling... I need to be able to run using a script not thru the Sql
Scheduler.
DECLARE @.name VARCHAR(50) -- database name
DECLARE @.path VARCHAR(256) -- path for backup files
DECLARE @.fileName VARCHAR(256) -- filename for backup
DECLARE @.fileDate VARCHAR(20) -- used for file name
SET @.path = 'C:\Backup\'
SELECT @.fileDate = CONVERT(VARCHAR(20),GETDATE(),112)
DECLARE db_cursor CURSOR FOR
SELECT name
FROM master.dbo.sysdatabases
WHERE name NOT IN ('master','model','msdb','tempdb')
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
SET @.fileName = @.path + @.name + '_' + @.fileDate + '.BAK'
BACKUP DATABASE @.name TO DISK = @.fileName
FETCH NEXT FROM db_cursor INTO @.name
END
CLOSE db_cursor
DEALLOCATE db_cursorHi
You could test @.@.ERROR after performing the backup to see if the backup
command worked and store a list of failures, but some errors will abort the
batch and therefore subsequent databases will not be backed up. SQL2005 has
better error handling. The script can be run using OSQL with the -i flag if
you save the script to a file. The -b flag reports as a command line error
any error value so it could be trapped using ERRORLEVEL it will be 1 if one
of the backups failed. You may also want to use the -n flag to suppress line
numbers. If using SQL Agent you do not need to use a command prompt.
Your backups will append to any files that are already present with the
given name you may want to specify the INIT command if you want to overwrite
these.
John
"AHartman" wrote:
> If there a way to detect if backup fails? I like to add better error
> handling... I need to be able to run using a script not thru the Sql
> Scheduler.
> DECLARE @.name VARCHAR(50) -- database name
> DECLARE @.path VARCHAR(256) -- path for backup files
> DECLARE @.fileName VARCHAR(256) -- filename for backup
> DECLARE @.fileDate VARCHAR(20) -- used for file name
> SET @.path = 'C:\Backup\'
> SELECT @.fileDate = CONVERT(VARCHAR(20),GETDATE(),112)
> DECLARE db_cursor CURSOR FOR
> SELECT name
> FROM master.dbo.sysdatabases
> WHERE name NOT IN ('master','model','msdb','tempdb')
> OPEN db_cursor
> FETCH NEXT FROM db_cursor INTO @.name
> WHILE @.@.FETCH_STATUS = 0
> BEGIN
> SET @.fileName = @.path + @.name + '_' + @.fileDate + '.BAK'
> BACKUP DATABASE @.name TO DISK = @.fileName
> FETCH NEXT FROM db_cursor INTO @.name
> END
> CLOSE db_cursor
> DEALLOCATE db_cursor
>|||Thanks... for the info
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:45510EB6-452B-4597-8775-99F7FC501054@.microsoft.com...
> Hi
> You could test @.@.ERROR after performing the backup to see if the backup
> command worked and store a list of failures, but some errors will abort
> the
> batch and therefore subsequent databases will not be backed up. SQL2005
> has
> better error handling. The script can be run using OSQL with the -i flag
> if
> you save the script to a file. The -b flag reports as a command line error
> any error value so it could be trapped using ERRORLEVEL it will be 1 if
> one
> of the backups failed. You may also want to use the -n flag to suppress
> line
> numbers. If using SQL Agent you do not need to use a command prompt.
> Your backups will append to any files that are already present with the
> given name you may want to specify the INIT command if you want to
> overwrite
> these.
> John
> "AHartman" wrote:
>> If there a way to detect if backup fails? I like to add better error
>> handling... I need to be able to run using a script not thru the Sql
>> Scheduler.
>> DECLARE @.name VARCHAR(50) -- database name
>> DECLARE @.path VARCHAR(256) -- path for backup files
>> DECLARE @.fileName VARCHAR(256) -- filename for backup
>> DECLARE @.fileDate VARCHAR(20) -- used for file name
>> SET @.path = 'C:\Backup\'
>> SELECT @.fileDate = CONVERT(VARCHAR(20),GETDATE(),112)
>> DECLARE db_cursor CURSOR FOR
>> SELECT name
>> FROM master.dbo.sysdatabases
>> WHERE name NOT IN ('master','model','msdb','tempdb')
>> OPEN db_cursor
>> FETCH NEXT FROM db_cursor INTO @.name
>> WHILE @.@.FETCH_STATUS = 0
>> BEGIN
>> SET @.fileName = @.path + @.name + '_' + @.fileDate + '.BAK'
>> BACKUP DATABASE @.name TO DISK = @.fileName
>> FETCH NEXT FROM db_cursor INTO @.name
>> END
>> CLOSE db_cursor
>> DEALLOCATE db_cursor
>>sql

Monday, March 19, 2012

Could not restore db from the backup file. Please help!

Hi All,
I normally restore a database from a backup file as a test
db for myself on daily basis without any problems. But
somehow today, I got this kind of error if I ran the
restore task from EM:
"SqlDumpExceptionHandler: Process 52 generated fatal
exception C0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server
is terminating this process".
If I ran restore sql statement from query analyzer, it
returned succeed message; however, from the EM the
restored db is marked with loading and I couldn't use it.
I digged into this problem but couldn't find any answers.
Please help
OrchidSounds like a corrupt backup (which you should expect
occasionally).
>--Original Message--
>Hi All,
>I normally restore a database from a backup file as a
test
>db for myself on daily basis without any problems. But
>somehow today, I got this kind of error if I ran the
>restore task from EM:
>"SqlDumpExceptionHandler: Process 52 generated fatal
>exception C0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server
>is terminating this process".
>If I ran restore sql statement from query analyzer, it
>returned succeed message; however, from the EM the
>restored db is marked with loading and I couldn't use
it.
>I digged into this problem but couldn't find any
answers.
>Please help
>Orchid
>.
>|||How can I figure out it's a corrupt backup? and How can I
fix it? Thanks
>--Original Message--
>Sounds like a corrupt backup (which you should expect
>occasionally).
>>--Original Message--
>>Hi All,
>>I normally restore a database from a backup file as a
>test
>>db for myself on daily basis without any problems. But
>>somehow today, I got this kind of error if I ran the
>>restore task from EM:
>>"SqlDumpExceptionHandler: Process 52 generated fatal
>>exception C0000005 EXCEPTION_ACCESS_VIOLATION. SQL
Server
>>is terminating this process".
>>If I ran restore sql statement from query analyzer, it
>>returned succeed message; however, from the EM the
>>restored db is marked with loading and I couldn't use
>it.
>>I digged into this problem but couldn't find any
>answers.
>>Please help
>>Orchid
>>.
>.
>

Thursday, March 8, 2012

Could not find the index entry for RID...

Greetings. Today I was testing the sql backup/restore functions on our
primary server. I was able to backup my database without any problems
but when I tried to restore it, I received an error "Could not find the
index entry for RID '3610200101a03cc4b49d8bbc84bac50cbe042cecf76' in
index page (1:40), index ID 0, database 'walkthrough'." Thinking that
data had been corrupted somehow I tried another database and received a
similar error for that database. In the past, our service provider has
attempted to restore data to this server and the restore failed do to
another data corruption. The problem is, I can't find out where the
corruption is located or how to fix it.

When I open the restored database in enterprise manager, it returns the
above error and is unable to get a listing of my tables. In query
analyzer I am able to view my data but receive the index error when I
attempt to look at the information_schema data. When I try to run a DBCC
CHECKDB on the corrupted database it reports 0 errors and 0
inconsistencies.

So my diagnosis of the problem is that something is corrupting my system
tables and that problem shows up whenever I try to restore data from a
backup. There could be a hardware failure but I believe the failure
would affect more then just the sql system tables. Can anyone offer any
advice on how to find the corruption?

Thank you in advance

Richard Bailey

*** Sent via Developersdex http://www.developersdex.com ***Hi

If a DBCC CHECKDB does not help see
http://msdn.microsoft.com/library/d...serr_1_23sk.asp
and
http://groups-beta.google.com/group...4b56fb232?hl=en
then you may want to call PSS. Also you may want to look for anything in the
event log and run some diagnostics on the disc.This will depend on what sort
of contract you have with the service provider.

http://msdn.microsoft.com/library/d...nsetup_1s8i.asp
http://support.microsoft.com/default.aspx

John

"Richard Bailey" <rbailey@.401kexchange.com> wrote in message
news:I37he.269$sW5.5880@.news.uswest.net...
> Greetings. Today I was testing the sql backup/restore functions on our
> primary server. I was able to backup my database without any problems
> but when I tried to restore it, I received an error "Could not find the
> index entry for RID '3610200101a03cc4b49d8bbc84bac50cbe042cecf76' in
> index page (1:40), index ID 0, database 'walkthrough'." Thinking that
> data had been corrupted somehow I tried another database and received a
> similar error for that database. In the past, our service provider has
> attempted to restore data to this server and the restore failed do to
> another data corruption. The problem is, I can't find out where the
> corruption is located or how to fix it.
> When I open the restored database in enterprise manager, it returns the
> above error and is unable to get a listing of my tables. In query
> analyzer I am able to view my data but receive the index error when I
> attempt to look at the information_schema data. When I try to run a DBCC
> CHECKDB on the corrupted database it reports 0 errors and 0
> inconsistencies.
> So my diagnosis of the problem is that something is corrupting my system
> tables and that problem shows up whenever I try to restore data from a
> backup. There could be a hardware failure but I believe the failure
> would affect more then just the sql system tables. Can anyone offer any
> advice on how to find the corruption?
> Thank you in advance
> Richard Bailey
> *** Sent via Developersdex http://www.developersdex.com ***

Could not find stored procedure.....SQL 2000

We are setting up a new server to replace a currently running SQL 2000
server. After restoring the database from a backup, when we attempt to log in
using a custom application, we get an error message stating "[Microsoft][ODBC
SQL Server Driver][SQL Server]Cound not find stored procedure
'drs_AuthenticateCurrentUser'. I can see that stored procedure listed in the
Stored Procedures subfolder in the restored database. I ran the restore from
Enterprise Manager just using the wizzard and had no issues when restoring.
Any ideas?
What user are you connecting as? What is that user's default database? Are
you sure you're executing in the right database? (A common problem is that
a connection string without a database specified would default to a user's
default database, but if the database is dropped/re-created/renamed...) Who
is the owner of the stored procedure? If it is dbo, did you try EXEC
dbo.drs_AuthenticateCurrentUser instead of EXEC drs_AuthenticateCurrentUser?
It is always a good idea to prefix object names both when creating and when
executing.
Aaron Bertrand
SQL Server MVP
"Jason Carter" <JasonCarter@.discussions.microsoft.com> wrote in message
news:0A96F5C3-EB54-46B7-A7B2-3EBAD3E9842B@.microsoft.com...
> We are setting up a new server to replace a currently running SQL 2000
> server. After restoring the database from a backup, when we attempt to log
> in
> using a custom application, we get an error message stating
> "[Microsoft][ODBC
> SQL Server Driver][SQL Server]Cound not find stored procedure
> 'drs_AuthenticateCurrentUser'. I can see that stored procedure listed in
> the
> Stored Procedures subfolder in the restored database. I ran the restore
> from
> Enterprise Manager just using the wizzard and had no issues when
> restoring.
> Any ideas?
|||Thanks for the reply Aaron....
I have tried a number of users including sa. sa's default database is
'master', but the other users I have tried have their default databases set
to MTCCashRecon which is where the stored procedure is located. I have also
verified the permissions for each of those users in that database is the same
as the ones on the old server. The owner of the stored procedure is dbo. I
have not tried to manually execute that procedure; I have only lanched this
from the application. I am nowhere near a SQL DBA and kind of got forced into
this one. I do not have access to the code and do not know if the stored proc
is being called as dbo.drs_authenticateCurrentUser or if it is being called
simply by the name; although I can say that the database was simply restored
from a .BAK file and I would have hoped that it would have just worked.
I have considered using the Data Transformation Sets to get the stored
procedures from the old server, but am not sure how that affects the old
server since it is still in use; does it lock the server or move any stored
procedures vs. just copying them.

Could not find stored procedure.....SQL 2000

We are setting up a new server to replace a currently running SQL 2000
server. After restoring the database from a backup, when we attempt to log i
n
using a custom application, we get an error message stating "[Microsoft]
[ODBC
SQL Server Driver][SQL Server]Cound not find stored procedure
'drs_AuthenticateCurrentUser'. I can see that stored procedure listed in the
Stored Procedures subfolder in the restored database. I ran the restore from
Enterprise Manager just using the wizzard and had no issues when restoring.
Any ideas?What user are you connecting as? What is that user's default database? Are
you sure you're executing in the right database? (A common problem is that
a connection string without a database specified would default to a user's
default database, but if the database is dropped/re-created/renamed...) Who
is the owner of the stored procedure? If it is dbo, did you try EXEC
dbo.drs_AuthenticateCurrentUser instead of EXEC drs_AuthenticateCurrentUser?
It is always a good idea to prefix object names both when creating and when
executing.
Aaron Bertrand
SQL Server MVP
"Jason Carter" <JasonCarter@.discussions.microsoft.com> wrote in message
news:0A96F5C3-EB54-46B7-A7B2-3EBAD3E9842B@.microsoft.com...
> We are setting up a new server to replace a currently running SQL 2000
> server. After restoring the database from a backup, when we attempt to log
> in
> using a custom application, we get an error message stating
> "[Microsoft][ODBC
> SQL Server Driver][SQL Server]Cound not find stored procedure
> 'drs_AuthenticateCurrentUser'. I can see that stored procedure listed in
> the
> Stored Procedures subfolder in the restored database. I ran the restore
> from
> Enterprise Manager just using the wizzard and had no issues when
> restoring.
> Any ideas?|||Thanks for the reply Aaron....
I have tried a number of users including sa. sa's default database is
'master', but the other users I have tried have their default databases set
to MTCCashRecon which is where the stored procedure is located. I have also
verified the permissions for each of those users in that database is the sam
e
as the ones on the old server. The owner of the stored procedure is dbo. I
have not tried to manually execute that procedure; I have only lanched this
from the application. I am nowhere near a SQL DBA and kind of got forced int
o
this one. I do not have access to the code and do not know if the stored pro
c
is being called as dbo.drs_authenticateCurrentUser or if it is being called
simply by the name; although I can say that the database was simply restored
from a .BAK file and I would have hoped that it would have just worked.
I have considered using the Data Transformation Sets to get the stored
procedures from the old server, but am not sure how that affects the old
server since it is still in use; does it lock the server or move any stored
procedures vs. just copying them.

Could not find stored procedure.....SQL 2000

We are setting up a new server to replace a currently running SQL 2000
server. After restoring the database from a backup, when we attempt to log in
using a custom application, we get an error message stating "[Microsoft][ODBC
SQL Server Driver][SQL Server]Cound not find stored procedure
'drs_AuthenticateCurrentUser'. I can see that stored procedure listed in the
Stored Procedures subfolder in the restored database. I ran the restore from
Enterprise Manager just using the wizzard and had no issues when restoring.
Any ideas?What user are you connecting as? What is that user's default database? Are
you sure you're executing in the right database? (A common problem is that
a connection string without a database specified would default to a user's
default database, but if the database is dropped/re-created/renamed...) Who
is the owner of the stored procedure? If it is dbo, did you try EXEC
dbo.drs_AuthenticateCurrentUser instead of EXEC drs_AuthenticateCurrentUser?
It is always a good idea to prefix object names both when creating and when
executing.
--
Aaron Bertrand
SQL Server MVP
"Jason Carter" <JasonCarter@.discussions.microsoft.com> wrote in message
news:0A96F5C3-EB54-46B7-A7B2-3EBAD3E9842B@.microsoft.com...
> We are setting up a new server to replace a currently running SQL 2000
> server. After restoring the database from a backup, when we attempt to log
> in
> using a custom application, we get an error message stating
> "[Microsoft][ODBC
> SQL Server Driver][SQL Server]Cound not find stored procedure
> 'drs_AuthenticateCurrentUser'. I can see that stored procedure listed in
> the
> Stored Procedures subfolder in the restored database. I ran the restore
> from
> Enterprise Manager just using the wizzard and had no issues when
> restoring.
> Any ideas?|||Thanks for the reply Aaron....
I have tried a number of users including sa. sa's default database is
'master', but the other users I have tried have their default databases set
to MTCCashRecon which is where the stored procedure is located. I have also
verified the permissions for each of those users in that database is the same
as the ones on the old server. The owner of the stored procedure is dbo. I
have not tried to manually execute that procedure; I have only lanched this
from the application. I am nowhere near a SQL DBA and kind of got forced into
this one. I do not have access to the code and do not know if the stored proc
is being called as dbo.drs_authenticateCurrentUser or if it is being called
simply by the name; although I can say that the database was simply restored
from a .BAK file and I would have hoped that it would have just worked.
I have considered using the Data Transformation Sets to get the stored
procedures from the old server, but am not sure how that affects the old
server since it is still in use; does it lock the server or move any stored
procedures vs. just copying them.

Friday, February 24, 2012

Could not clear ''DIFF'' bitmap in database due to error 9002

Could not clear 'DIFF' bitmap in database due to error 9002 . A subsequent backup operation may be slower/larger than normal .

Have you checked the transaction log for that database? Is it properly sized?

WesleyB

Visit my SQL Server weblog @. http://dis4ea.blogspot.com

Sunday, February 19, 2012

Could making an extra backup cause data loss?

I'm wondering whether in some circumstances, making an additional SQL backup
could cause data loss.
For ezample, a database is configured with the full recovery model. The DBA,
Alice, has scheduled daily full backups at 0200, and transaction log backups
at 0000, 0600, 1200 and 1800.
Suppose programmer Bob makes an additional full backup at 1000 so that he
can copy the database to his laptop, then removes this backup from the
server and doesn't tell Alice.
What happens if Alice wants to do a restore at 1201? Can she just restore
the 0200 full backup followed by the 0600 and 1200 transaction log backups,
or will there be missing data between 0600 and 1000?
Any comments appreciated. Thanks,
Simon
Hi
A full back does not affect the transaction log sequence as long as you do
not set it to truncate the log also (option when you do it through
Enterprise Manager).
In your case, the full backup contains all the data and the log from 0600,
but does not truncate the log. The 1200 log dump contains the log from 0600
to 1200.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Simon" <simon@.antispam.aardvarks> wrote in message
news:419524d5$0$226$bed64819@.news.gradwell.net...
> I'm wondering whether in some circumstances, making an additional SQL
backup
> could cause data loss.
> For ezample, a database is configured with the full recovery model. The
DBA,
> Alice, has scheduled daily full backups at 0200, and transaction log
backups
> at 0000, 0600, 1200 and 1800.
> Suppose programmer Bob makes an additional full backup at 1000 so that he
> can copy the database to his laptop, then removes this backup from the
> server and doesn't tell Alice.
> What happens if Alice wants to do a restore at 1201? Can she just restore
> the 0200 full backup followed by the 0600 and 1200 transaction log
backups,
> or will there be missing data between 0600 and 1000?
> Any comments appreciated. Thanks,
> Simon
>
|||As mike says - the good thing about log backups is that they are not affected
by full backups - if you have the sequence of logs you can restore from any
full backup.
It's important that Bob doesn't do a log backup though as this will cause
problems - even if he uses the NO_TRUNCATE option.
"Simon" wrote:

> I'm wondering whether in some circumstances, making an additional SQL backup
> could cause data loss.
> For ezample, a database is configured with the full recovery model. The DBA,
> Alice, has scheduled daily full backups at 0200, and transaction log backups
> at 0000, 0600, 1200 and 1800.
> Suppose programmer Bob makes an additional full backup at 1000 so that he
> can copy the database to his laptop, then removes this backup from the
> server and doesn't tell Alice.
> What happens if Alice wants to do a restore at 1201? Can she just restore
> the 0200 full backup followed by the 0600 and 1200 transaction log backups,
> or will there be missing data between 0600 and 1000?
> Any comments appreciated. Thanks,
> Simon
>
>

Could making an extra backup cause data loss?

I'm wondering whether in some circumstances, making an additional SQL backup
could cause data loss.
For ezample, a database is configured with the full recovery model. The DBA,
Alice, has scheduled daily full backups at 0200, and transaction log backups
at 0000, 0600, 1200 and 1800.
Suppose programmer Bob makes an additional full backup at 1000 so that he
can copy the database to his laptop, then removes this backup from the
server and doesn't tell Alice.
What happens if Alice wants to do a restore at 1201? Can she just restore
the 0200 full backup followed by the 0600 and 1200 transaction log backups,
or will there be missing data between 0600 and 1000?
Any comments appreciated. Thanks,
SimonHi
A full back does not affect the transaction log sequence as long as you do
not set it to truncate the log also (option when you do it through
Enterprise Manager).
In your case, the full backup contains all the data and the log from 0600,
but does not truncate the log. The 1200 log dump contains the log from 0600
to 1200.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Simon" <simon@.antispam.aardvarks> wrote in message
news:419524d5$0$226$bed64819@.news.gradwell.net...
> I'm wondering whether in some circumstances, making an additional SQL
backup
> could cause data loss.
> For ezample, a database is configured with the full recovery model. The
DBA,
> Alice, has scheduled daily full backups at 0200, and transaction log
backups
> at 0000, 0600, 1200 and 1800.
> Suppose programmer Bob makes an additional full backup at 1000 so that he
> can copy the database to his laptop, then removes this backup from the
> server and doesn't tell Alice.
> What happens if Alice wants to do a restore at 1201? Can she just restore
> the 0200 full backup followed by the 0600 and 1200 transaction log
backups,
> or will there be missing data between 0600 and 1000?
> Any comments appreciated. Thanks,
> Simon
>|||As mike says - the good thing about log backups is that they are not affected
by full backups - if you have the sequence of logs you can restore from any
full backup.
It's important that Bob doesn't do a log backup though as this will cause
problems - even if he uses the NO_TRUNCATE option.
"Simon" wrote:
> I'm wondering whether in some circumstances, making an additional SQL backup
> could cause data loss.
> For ezample, a database is configured with the full recovery model. The DBA,
> Alice, has scheduled daily full backups at 0200, and transaction log backups
> at 0000, 0600, 1200 and 1800.
> Suppose programmer Bob makes an additional full backup at 1000 so that he
> can copy the database to his laptop, then removes this backup from the
> server and doesn't tell Alice.
> What happens if Alice wants to do a restore at 1201? Can she just restore
> the 0200 full backup followed by the 0600 and 1200 transaction log backups,
> or will there be missing data between 0600 and 1000?
> Any comments appreciated. Thanks,
> Simon
>
>

Could making an extra backup cause data loss?

I'm wondering whether in some circumstances, making an additional SQL backup
could cause data loss.
For ezample, a database is configured with the full recovery model. The DBA,
Alice, has scheduled daily full backups at 0200, and transaction log backups
at 0000, 0600, 1200 and 1800.
Suppose programmer Bob makes an additional full backup at 1000 so that he
can copy the database to his laptop, then removes this backup from the
server and doesn't tell Alice.
What happens if Alice wants to do a restore at 1201? Can she just restore
the 0200 full backup followed by the 0600 and 1200 transaction log backups,
or will there be missing data between 0600 and 1000?
Any comments appreciated. Thanks,
SimonHi
A full back does not affect the transaction log sequence as long as you do
not set it to truncate the log also (option when you do it through
Enterprise Manager).
In your case, the full backup contains all the data and the log from 0600,
but does not truncate the log. The 1200 log dump contains the log from 0600
to 1200.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Simon" <simon@.antispam.aardvarks> wrote in message
news:419524d5$0$226$bed64819@.news.gradwell.net...
> I'm wondering whether in some circumstances, making an additional SQL
backup
> could cause data loss.
> For ezample, a database is configured with the full recovery model. The
DBA,
> Alice, has scheduled daily full backups at 0200, and transaction log
backups
> at 0000, 0600, 1200 and 1800.
> Suppose programmer Bob makes an additional full backup at 1000 so that he
> can copy the database to his laptop, then removes this backup from the
> server and doesn't tell Alice.
> What happens if Alice wants to do a restore at 1201? Can she just restore
> the 0200 full backup followed by the 0600 and 1200 transaction log
backups,
> or will there be missing data between 0600 and 1000?
> Any comments appreciated. Thanks,
> Simon
>|||As mike says - the good thing about log backups is that they are not affecte
d
by full backups - if you have the sequence of logs you can restore from any
full backup.
It's important that Bob doesn't do a log backup though as this will cause
problems - even if he uses the NO_TRUNCATE option.
"Simon" wrote:

> I'm wondering whether in some circumstances, making an additional SQL back
up
> could cause data loss.
> For ezample, a database is configured with the full recovery model. The DB
A,
> Alice, has scheduled daily full backups at 0200, and transaction log backu
ps
> at 0000, 0600, 1200 and 1800.
> Suppose programmer Bob makes an additional full backup at 1000 so that he
> can copy the database to his laptop, then removes this backup from the
> server and doesn't tell Alice.
> What happens if Alice wants to do a restore at 1201? Can she just restore
> the 0200 full backup followed by the 0600 and 1200 transaction log backups
,
> or will there be missing data between 0600 and 1000?
> Any comments appreciated. Thanks,
> Simon
>
>

Friday, February 17, 2012

Could anyone kindly tell me,What tool can I use to Create db or restore db or backup db in SQL 2

Could anyone kindly tell me,What tool can I use to Create db or restore db or backup db in SQL 2005 Express?
I DownLoad the tool named XM.exe,but It's only a Query tool and I have to do everything using scripts.I realy want to know Is there a tool that I can use to Create db and restore db and backup db and create table etc. like the Admination tools in SQL 2000 ?

Thanks for u kindness.

Tonny.

You can use the tools that come with the June CTP Developer Edition.

|||

Thanks for ur kindness ,and Is it a single tool or integrated with the SQL2005 TCP Developer Version?Is it free to download?If yes, Could u tell me where Can I Download the tool or Where Can I DownLoad the SQL 2005 TCP Developer Version?

Thank u again.

Tonny.

|||

SQL Server Express Edition did not originally ship with any type of Management Tools. After SQL Server 2005 Service Pack 1, you have the option to download SQL Server Management Studio Express with SQL Server Express Edition with Advanced Services.

Compare the new offerings: http://msdn.microsoft.com/vstudio/express/sql/compare/default.aspx.

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

Could anyone kindly tell me,What tool can I use to Create db or restore db or backup db in S

Could anyone kindly tell me,What tool can I use to Create db or restore db or backup db in SQL 2005 Express?
I DownLoad the tool named XM.exe,but It's only a Query tool and I have to do everything using scripts.I realy want to know Is there a tool that I can use to Create db and restore db and backup db and create table etc. like the Admination tools in SQL 2000 ?

Thanks for u kindness.

Tonny.

You can use the tools that come with the June CTP Developer Edition.

|||

Thanks for ur kindness ,and Is it a single tool or integrated with the SQL2005 TCP Developer Version?Is it free to download?If yes, Could u tell me where Can I Download the tool or Where Can I DownLoad the SQL 2005 TCP Developer Version?

Thank u again.

Tonny.

|||

SQL Server Express Edition did not originally ship with any type of Management Tools. After SQL Server 2005 Service Pack 1, you have the option to download SQL Server Management Studio Express with SQL Server Express Edition with Advanced Services.

Compare the new offerings: http://msdn.microsoft.com/vstudio/express/sql/compare/default.aspx.

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

Could anyone help? backup error

Database: SQL2000
OS: Windows 2000 SP4
Backup device: local hard disk (E Drive)

When I backup the database I got this error: BackupMedium::ReportIoError: write failure on backup device 'E:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\5WavesDB'. Operating system error 112(There is not enough space on the disk.).

My backup file only needs 4G and my E Drive has 13G free. My log files has been set to "growth automatically". Does anyone help to give some advise on this. Thank you for any help.you'd get this error if your data and log device sizes exceed 13g. try to shrink your log device(-s). if this operation does not result in a smaller log device size check for open trans in your database.|||Have you ran chkdsk on this disk? If you really have 13g free it shouldn't be an issue.
Just as an fyi, if you are not doing transaction log backups you need to set your recovery mode to Simple on your databases. Otherwise, your transaction logs will get huge.

Corruption of backup file on remote server

Dear all,

What I want to do is to backup my database through the SQL script, when the backup is successful, the .bak file is saved in my local harddisk. After that, I used the XYRunProc to execute a "copy" command to copy the .bak file to a remote server.

However, when I want to restore the database using the .bak on the remote server, I found that the .bak is corrupted. This problem does not exist if the file is copied to the remote server manually (click copy on local server and click paste on remote server).

Do anyone know what's the problem of this? This really made me very frustrated. Hope someone can help me, thank you very much!

Regards,
Strike

Hi Strike,

XYRunProc is an extended stored procedure written by someone outside of Microsoft. I couldn't even begin to tell you how it works or why it might be causing problems when copying files. Since a manual copy doesn't seem to affect the .bak file, it's clearly something about how XYRunProc is handling it.

I would suggest you contact the author of the xProc to determine what might be happening during the file copy.

Regards,

Mike Wachal
SQL Express team

-
Mark the best posts as Answers!

Tuesday, February 14, 2012

Corrupted ReportServerTempDB

Hi,
Need help here. I have reporting services installed on a sql cluster
and backup running every night for the 2 databases: ReportServer and
ReportServerTempDB. However a few weeks ago, the backup started
failing because ReportServerTempDB failed the DBCC CheckDB test with
the following error message:
Incorrect PFS free space information for page (1:184) in object ID
2105058535, index ID 1, partition ID 72057594038517760, alloc unit ID
72057594043498496 (type LOB data).
Expected value 0_PCT_FULL, actual value 100_PCT_FULL.
>From what I've read, that usually means that the db is corrupted and I
should restore from the backup... but seeing that this is the
temporary db, would it be possible to just delete the corrupted on and
recreate the ReportServerTempDB? Any impact?
ThxHello,
Yes you can drop ReportServerTempDB database and then recreate it:
After creating a new database ReportServerTempDB, create a Role
called RSExecRole , then you can run the script CatalogTempDB.sql. to
recreate the missing ReportServerTempDB objects.
(Go to your original installation bits and grab the file named
CatalogTempDB.sql located in the directory ..\Setup\Report Server\Reporting
Services\ReportServer.)
You will also need to make sure all the users that are in the RSExecRole in
the ReportServer Database
are in the ReportServerTempDB's RSExecRole.
Regards,
Radoslaw Lebkowski
Uzytkownik <aifong@.gmail.com> napisal w wiadomosci
news:1170909371.919215.218860@.l53g2000cwa.googlegroups.com...
> Hi,
> Need help here. I have reporting services installed on a sql cluster
> and backup running every night for the 2 databases: ReportServer and
> ReportServerTempDB. However a few weeks ago, the backup started
> failing because ReportServerTempDB failed the DBCC CheckDB test with
> the following error message:
> Incorrect PFS free space information for page (1:184) in object ID
> 2105058535, index ID 1, partition ID 72057594038517760, alloc unit ID
> 72057594043498496 (type LOB data).
> Expected value 0_PCT_FULL, actual value 100_PCT_FULL.
>>From what I've read, that usually means that the db is corrupted and I
> should restore from the backup... but seeing that this is the
> temporary db, would it be possible to just delete the corrupted on and
> recreate the ReportServerTempDB? Any impact?
> Thx
>|||Hi Radoslaw,
Thanks! I just tested it on a separate installation and it works.
Just a note on the collation, it has to be exactly the same as
ReportServer DB otherwise it gives an error. Other than that, A-ok.
Thanks,
AF
On Feb 8, 8:27 pm, "Radoslaw Lebkowski" <rade...@.wp.pl> wrote:
> Hello,
> Yes you can drop ReportServerTempDB database and then recreate it:
> After creating a new database ReportServerTempDB, create a Role
> called RSExecRole , then you can run the script CatalogTempDB.sql. to
> recreate the missing ReportServerTempDB objects.
> (Go to your original installation bits and grab the file named
> CatalogTempDB.sql located in the directory ..\Setup\Report Server\Reporting
> Services\ReportServer.)
> You will also need to make sure all the users that are in the RSExecRole in
> the ReportServer Database
> are in the ReportServerTempDB's RSExecRole.
> Regards,
> Radoslaw Lebkowski
> Uzytkownik <aif...@.gmail.com> napisal w wiadomoscinews:1170909371.919215.218860@.l53g2000cwa.googlegroups.com...
>
> > Hi,
> > Need help here. I have reporting services installed on a sql cluster
> > and backup running every night for the 2 databases: ReportServer and
> > ReportServerTempDB. However a few weeks ago, the backup started
> > failing because ReportServerTempDB failed the DBCC CheckDB test with
> > the following error message:
> > Incorrect PFS free space information for page (1:184) in object ID
> > 2105058535, index ID 1, partition ID 72057594038517760, alloc unit ID
> > 72057594043498496 (type LOB data).
> > Expected value 0_PCT_FULL, actual value 100_PCT_FULL.
> >>From what I've read, that usually means that the db is corrupted and I
> > should restore from the backup... but seeing that this is the
> > temporary db, would it be possible to just delete the corrupted on and
> > recreate the ReportServerTempDB? Any impact?
> > Thx- Hide quoted text -
> - Show quoted text -

Corrupted Log Backup

Hi..!

Is it possible to recover data from corrupted log backup ?

Suppose we have 10 log files and 8th is corrupted then how can we recover database.

I am not facing such problem right now, but it's a question raised in my mind.

I would like to have your help, suggestions & comments. :rolleyes:

Thanks...Hi..!

Is it possible to recover data from corrupted log backup ?

Suppose we have 10 log files and 8th is corrupted then how can we recover database.

I am not facing such problem right now, but it's a question raised in my mind.

I would like to have your help, suggestions & comments. :rolleyes:

Thanks...

If the 8th log file is corrupt, then you would only be able to recover to the end of the 7th log file. It's (remotely) possible that you might be able to recover to some mid-point within the 8th log file using point-in-time recovery, but I would not count on it.

Personally, I always try to configure my production environment to do nightly full backups of all the databases and hourly transaction logs. I try to keep two full backups on disk, plus enough transaction log files to recover from the oldest full backup. I am now using a backup compression utility which speeds the process and shrinks the files making storage a non-issue. The only exception is a medium-large database that I have (300+ GB) that I backup weekly (storage capacity being the main factor in limiting backup frequency).

Remember to:
1. Practice various recovery scenarios
2. Periodically check the validity/recoverability of various backup media (disk/tape).
3. Write down your recovery strategy and file it away somewhere.

Regards,

hmscott|||Thanks... :)

corrupted backup file

We run SQL backup jobs everyday to backup the DB. Our server crashed,
so we're trying to restore the database using the backup file (*.bak)
However, we noticed that we're unable to restore the DB because the
backup file is corrupted. Does anyone have any suggestion how we can
restore the DB? I'm not sure if our MDF & LDF files are good. If MDF &
LDF are also corrupted, how do we restore our DB using the corrupted
backup file? Help!Try attaching the mdf, ndf, ldf files using sp_attach_db or even sp_attach_s
ingle_file_db. Read
about the commands in Books Online. If that doesn't work and your backup fil
es are corrupt, you are
probably toast. Open a case with MS Support and see if they can assist in an
y way. Or revert to the
oldest OK backup files.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Yvonne" <y999yy@.yahoo.com> wrote in message news:cc95dfb3.0406302236.57ab05be@.posting.googl
e.com...
> We run SQL backup jobs everyday to backup the DB. Our server crashed,
> so we're trying to restore the database using the backup file (*.bak)
> However, we noticed that we're unable to restore the DB because the
> backup file is corrupted. Does anyone have any suggestion how we can
> restore the DB? I'm not sure if our MDF & LDF files are good. If MDF &
> LDF are also corrupted, how do we restore our DB using the corrupted
> backup file? Help!|||Tried both sp_attach_db & sp_attach_single_file_db, but failed. Seems
some problem with the log file that the DB is unable to be recreated.
One question, the DB was originally installed on SQL 2000 Personal
version. Was trying to attach to SQL 2000 Enterprise version. Does
that make any differece? Should we try to attach the DB to a personal
version?
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news:<ef
oIZgzXEHA.716@.TK2MSFTNGP11.phx.gbl>...[vbcol=seagreen]
> Try attaching the mdf, ndf, ldf files using sp_attach_db or even sp_attach
_single_file_db. Read
> about the commands in Books Online. If that doesn't work and your backup f
iles are corrupt, you are
> probably toast. Open a case with MS Support and see if they can assist in
any way. Or revert to the
> oldest OK backup files.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Yvonne" <y999yy@.yahoo.com> wrote in message news:cc95dfb3.0406302236.57ab
05be@.posting.google.com...|||Tried both sp_attach_db & sp_attach_single_file_db, but failed. Seems
some problem with the log file that the DB is unable to be recreated.
One question, the DB was originally installed on SQL 2000 Personal
version. Was trying to attach to SQL 2000 Enterprise version. Does
that make any differece? Should we try to attach the DB to a personal
version?
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news:<ef
oIZgzXEHA.716@.TK2MSFTNGP11.phx.gbl>...[vbcol=seagreen]
> Try attaching the mdf, ndf, ldf files using sp_attach_db or even sp_attach
_single_file_db. Read
> about the commands in Books Online. If that doesn't work and your backup f
iles are corrupt, you are
> probably toast. Open a case with MS Support and see if they can assist in
any way. Or revert to the
> oldest OK backup files.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Yvonne" <y999yy@.yahoo.com> wrote in message news:cc95dfb3.0406302236.57ab
05be@.posting.google.com...|||Tried both sp_attach_db & sp_attach_single_file_db, but failed. The
error is always on the ldf file. Isn't the DB able to recreate the log
file from mdf?
Since the origianl dB was installed on SQL 2000 personal version. Was
trying to restore to a SQL 2000 enterprise version. Does this also
make any difference?
Since our disk was corrupted, so I was afraid that the corrupted mdf
was on some bad sector of the disk. Any suggestion?
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news:<ef
oIZgzXEHA.716@.TK2MSFTNGP11.phx.gbl>...[vbcol=seagreen]
> Try attaching the mdf, ndf, ldf files using sp_attach_db or even sp_attach
_single_file_db. Read
> about the commands in Books Online. If that doesn't work and your backup f
iles are corrupt, you are
> probably toast. Open a case with MS Support and see if they can assist in
any way. Or revert to the
> oldest OK backup files.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Yvonne" <y999yy@.yahoo.com> wrote in message news:cc95dfb3.0406302236.57ab
05be@.posting.google.com...|||Tried both sp_attach_db & sp_attach_single_file_db, but failed. The
error is always on the ldf file. Isn't the DB able to recreate the log
file from mdf?
Since the origianl dB was installed on SQL 2000 personal version. Was
trying to restore to a SQL 2000 enterprise version. Does this also
make any difference?
Since our disk was corrupted, so I was afraid that the corrupted mdf
was on some bad sector of the disk. Any suggestion?
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news:<ef
oIZgzXEHA.716@.TK2MSFTNGP11.phx.gbl>...[vbcol=seagreen]
> Try attaching the mdf, ndf, ldf files using sp_attach_db or even sp_attach
_single_file_db. Read
> about the commands in Books Online. If that doesn't work and your backup f
iles are corrupt, you are
> probably toast. Open a case with MS Support and see if they can assist in
any way. Or revert to the
> oldest OK backup files.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Yvonne" <y999yy@.yahoo.com> wrote in message news:cc95dfb3.0406302236.57ab
05be@.posting.google.com...|||> Isn't the DB able to recreate the log
> file from mdf?
No. I suggest you read in Books Online about "automatic recovery" and you un
derstand why. If there
is not automatic recovery work to be done, and SQL Server know that, SQL Ser
ver can re-create a
transaction log file for you.

> Since the origianl dB was installed on SQL 2000 personal version. Was
> trying to restore to a SQL 2000 enterprise version. Does this also
> make any difference?
No. File format is the same over all editions.

> Since our disk was corrupted, so I was afraid that the corrupted mdf
> was on some bad sector of the disk. Any suggestion?
As I mentioned. Restore your latest clean backup or open a case with MS and
see if they can help
you.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Yvonne" <y999yy@.yahoo.com> wrote in message news:cc95dfb3.0407012212.212307e8@.posting.googl
e.com...
> Tried both sp_attach_db & sp_attach_single_file_db, but failed. The
> error is always on the ldf file. Isn't the DB able to recreate the log
> file from mdf?
> Since the origianl dB was installed on SQL 2000 personal version. Was
> trying to restore to a SQL 2000 enterprise version. Does this also
> make any difference?
> Since our disk was corrupted, so I was afraid that the corrupted mdf
> was on some bad sector of the disk. Any suggestion?
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in messag
e
news:<efoIZgzXEHA.716@.TK2MSFTNGP11.phx.gbl>...[vbcol=seagreen]
are[vbcol=seagreen]
the[vbcol=seagreen]
news:cc95dfb3.0406302236.57ab05be@.posting.google.com...[vbcol=seagreen]