Showing posts with label sounds. Show all posts
Showing posts with label sounds. Show all posts

Friday, February 24, 2012

Database recovery

Hi All,
Plaese excuse me if this sounds like a stupid question, my SQL sever crashed
and all my databases are gone. Which steps do I follow to restore my
database. In the backup folder of the Sql there is folders of database names
containg the table names with the extension "bak". Please help
For Each db,
Restore database <dbname> from disk = <completefilename>
You need to determine if you have log backups or only full database backups.
If you have log backups, then each db restore you should add ' with
norecovery', and use the restore log command to restore the logs...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Nkagi" <Nkagi@.discussions.microsoft.com> wrote in message
news:A0128E1C-76A2-4FFE-B977-E36759C436BF@.microsoft.com...
> Hi All,
> Plaese excuse me if this sounds like a stupid question, my SQL sever
crashed
> and all my databases are gone. Which steps do I follow to restore my
> database. In the backup folder of the Sql there is folders of database
names
> containg the table names with the extension "bak". Please help
|||To add to what Wayne has to say,
You should read the entire section on Backup and Recovery in the Books
Online. That way, you know that you covered all of your bases during the
restore process.
Rick Sawtell
MCT, MCSD, MCDBA
|||You will have to restore the master database first, then the model and msdb.
All of the remaining user databases can then be restored.
Make sure that you have brought the installation back to the same service
pack and hotfix levels before restore the master database.
Sincerely,
Anthony Thomas

"Wayne Snyder" <wayne.nospam.snyder@.mariner-usa.com> wrote in message
news:ud9IkmN7EHA.2316@.TK2MSFTNGP15.phx.gbl...
For Each db,
Restore database <dbname> from disk = <completefilename>
You need to determine if you have log backups or only full database backups.
If you have log backups, then each db restore you should add ' with
norecovery', and use the restore log command to restore the logs...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Nkagi" <Nkagi@.discussions.microsoft.com> wrote in message
news:A0128E1C-76A2-4FFE-B977-E36759C436BF@.microsoft.com...
> Hi All,
> Plaese excuse me if this sounds like a stupid question, my SQL sever
crashed
> and all my databases are gone. Which steps do I follow to restore my
> database. In the backup folder of the Sql there is folders of database
names
> containg the table names with the extension "bak". Please help
|||"Nkagi" <Nkagi@.discussions.microsoft.com> wrote in message
news:A0128E1C-76A2-4FFE-B977-E36759C436BF@.microsoft.com...
> Hi All,
> Plaese excuse me if this sounds like a stupid question, my SQL sever
crashed
> and all my databases are gone. Which steps do I follow to restore my
> database. In the backup folder of the Sql there is folders of database
names
> containg the table names with the extension "bak". Please help
You may also want to look for any .MDF and .LDF files.
It MAY be possible to reinstall SQL Server and them simply reattach these
sp_attach_db.
These will probably be more recent than your backups.

Database recovery

Hi All,
Plaese excuse me if this sounds like a stupid question, my SQL sever crashed
and all my databases are gone. Which steps do I follow to restore my
database. In the backup folder of the Sql there is folders of database names
containg the table names with the extension "bak". Please helpFor Each db,
Restore database <dbname> from disk = <completefilename>
You need to determine if you have log backups or only full database backups.
If you have log backups, then each db restore you should add ' with
norecovery', and use the restore log command to restore the logs...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Nkagi" <Nkagi@.discussions.microsoft.com> wrote in message
news:A0128E1C-76A2-4FFE-B977-E36759C436BF@.microsoft.com...
> Hi All,
> Plaese excuse me if this sounds like a stupid question, my SQL sever
crashed
> and all my databases are gone. Which steps do I follow to restore my
> database. In the backup folder of the Sql there is folders of database
names
> containg the table names with the extension "bak". Please help|||To add to what Wayne has to say,
You should read the entire section on Backup and Recovery in the Books
Online. That way, you know that you covered all of your bases during the
restore process.
Rick Sawtell
MCT, MCSD, MCDBA|||You will have to restore the master database first, then the model and msdb.
All of the remaining user databases can then be restored.
Make sure that you have brought the installation back to the same service
pack and hotfix levels before restore the master database.
Sincerely,
Anthony Thomas
"Wayne Snyder" <wayne.nospam.snyder@.mariner-usa.com> wrote in message
news:ud9IkmN7EHA.2316@.TK2MSFTNGP15.phx.gbl...
For Each db,
Restore database <dbname> from disk = <completefilename>
You need to determine if you have log backups or only full database backups.
If you have log backups, then each db restore you should add ' with
norecovery', and use the restore log command to restore the logs...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Nkagi" <Nkagi@.discussions.microsoft.com> wrote in message
news:A0128E1C-76A2-4FFE-B977-E36759C436BF@.microsoft.com...
> Hi All,
> Plaese excuse me if this sounds like a stupid question, my SQL sever
crashed
> and all my databases are gone. Which steps do I follow to restore my
> database. In the backup folder of the Sql there is folders of database
names
> containg the table names with the extension "bak". Please help|||"Nkagi" <Nkagi@.discussions.microsoft.com> wrote in message
news:A0128E1C-76A2-4FFE-B977-E36759C436BF@.microsoft.com...
> Hi All,
> Plaese excuse me if this sounds like a stupid question, my SQL sever
crashed
> and all my databases are gone. Which steps do I follow to restore my
> database. In the backup folder of the Sql there is folders of database
names
> containg the table names with the extension "bak". Please help
You may also want to look for any .MDF and .LDF files.
It MAY be possible to reinstall SQL Server and them simply reattach these
sp_attach_db.
These will probably be more recent than your backups.

Database recovery

Hi All,
Plaese excuse me if this sounds like a stupid question, my SQL sever crashed
and all my databases are gone. Which steps do I follow to restore my
database. In the backup folder of the Sql there is folders of database names
containg the table names with the extension "bak". Please helpFor Each db,
Restore database <dbname> from disk = <completefilename>
You need to determine if you have log backups or only full database backups.
If you have log backups, then each db restore you should add ' with
norecovery', and use the restore log command to restore the logs...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Nkagi" <Nkagi@.discussions.microsoft.com> wrote in message
news:A0128E1C-76A2-4FFE-B977-E36759C436BF@.microsoft.com...
> Hi All,
> Plaese excuse me if this sounds like a stupid question, my SQL sever
crashed
> and all my databases are gone. Which steps do I follow to restore my
> database. In the backup folder of the Sql there is folders of database
names
> containg the table names with the extension "bak". Please help|||To add to what Wayne has to say,
You should read the entire section on Backup and Recovery in the Books
Online. That way, you know that you covered all of your bases during the
restore process.
Rick Sawtell
MCT, MCSD, MCDBA|||You will have to restore the master database first, then the model and msdb.
All of the remaining user databases can then be restored.
Make sure that you have brought the installation back to the same service
pack and hotfix levels before restore the master database.
Sincerely,
Anthony Thomas
"Wayne Snyder" <wayne.nospam.snyder@.mariner-usa.com> wrote in message
news:ud9IkmN7EHA.2316@.TK2MSFTNGP15.phx.gbl...
For Each db,
Restore database <dbname> from disk = <completefilename>
You need to determine if you have log backups or only full database backups.
If you have log backups, then each db restore you should add ' with
norecovery', and use the restore log command to restore the logs...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Nkagi" <Nkagi@.discussions.microsoft.com> wrote in message
news:A0128E1C-76A2-4FFE-B977-E36759C436BF@.microsoft.com...
> Hi All,
> Plaese excuse me if this sounds like a stupid question, my SQL sever
crashed
> and all my databases are gone. Which steps do I follow to restore my
> database. In the backup folder of the Sql there is folders of database
names
> containg the table names with the extension "bak". Please help|||"Nkagi" <Nkagi@.discussions.microsoft.com> wrote in message
news:A0128E1C-76A2-4FFE-B977-E36759C436BF@.microsoft.com...
> Hi All,
> Plaese excuse me if this sounds like a stupid question, my SQL sever
crashed
> and all my databases are gone. Which steps do I follow to restore my
> database. In the backup folder of the Sql there is folders of database
names
> containg the table names with the extension "bak". Please help
You may also want to look for any .MDF and .LDF files.
It MAY be possible to reinstall SQL Server and them simply reattach these
sp_attach_db.
These will probably be more recent than your backups.

Friday, February 17, 2012

database performance

hello everyone,
i wasn't sure which sql newsgroup to post this question and server sounds
generic enough
i have a table named RDKCOCUS with 131 columns and over 44k records
sometimes the server will timeout when i select using this statement:
SELECT COUNT(CC.CusId) AS TOTALROWS FROM COCUS AS CC INNER JOIN RDKCOCUS AS
RCC ON CC.CusId = RCC.CusId WHERE (CC.CusId LIKE '%%') AND (CC.Name LIKE
'%%') AND (CC.Post LIKE '%' OR CC.Post IS NULL) AND (CC.Contact LIKE '%' OR
CC.Contact IS NULL) AND (CC.BillCusId LIKE '%%') AND (CC.BillPost LIKE '%'
OR CC.BillPost IS NULL) AND (CC.DateCreate BETWEEN '1/1/1900 12:00:00 AM'
AND '1/4/2006 11:59:59 PM') AND (CC.CusMisc1 LIKE '%' OR CC.CusMisc1 IS
NULL) AND (RCC.Hot LIKE '%') AND CC.CusId NOT IN (SELECT CC.CusId FROM COCUS
AS CC INNER JOIN CONOTITM AS CNI ON CC.NotId = CNI.NotId WHERE
(CNI.DateUpdate BETWEEN '12/5/2005 12:00:00 AM' AND '1/4/2006 11:59:59 PM')
AND (CNI.Des IS NOT NULL) AND (CNI.Des <> '')) AND CC.CusId NOT IN (SELECT
CC.CusId FROM COCUS AS CC INNER JOIN RDKCALLHIST AS RCH ON CC.CusId = RCH.CusId WHERE (RCH.DateCall BETWEEN '12/5/2005 12:00:00 AM' AND '1/4/2006
11:59:59 PM') AND (RCH.Completed = 1)) AND CC.CusId NOT IN (SELECT CC.CusId
FROM COCUS AS CC INNER JOIN RDKCOCUS AS RCC ON CC.CusId = RCC.CusId WHERE
(RCC.PrefEmpIdSpn IS NOT NULL) AND (RCC.PrefEmpIdSpn <> '')) AND CC.CusId
NOT LIKE '[&]%'
with no traffic and running the statement directly on the server takes about
10 seconds to complete.
does anyone have any information on server performance if i break up the 131
columns into more tables?
someone told me this may help but i need actual performance information
before i start that job :)
thank you,
abraham lunaI'm surprised you get timeouts. This is a very, very nasty query.
Don't break the tables. Breakup the query into stages. Work on creating
cleaner code.
d.
"Abraham Andres Luna" <abe@.rdk.com> wrote in message
news:%23bcuT8wEGHA.868@.TK2MSFTNGP10.phx.gbl...
> hello everyone,
> i wasn't sure which sql newsgroup to post this question and server sounds
> generic enough
> i have a table named RDKCOCUS with 131 columns and over 44k records
> sometimes the server will timeout when i select using this statement:
> SELECT COUNT(CC.CusId) AS TOTALROWS FROM COCUS AS CC INNER JOIN RDKCOCUS
AS
> RCC ON CC.CusId = RCC.CusId WHERE (CC.CusId LIKE '%%') AND (CC.Name LIKE
> '%%') AND (CC.Post LIKE '%' OR CC.Post IS NULL) AND (CC.Contact LIKE '%'
OR
> CC.Contact IS NULL) AND (CC.BillCusId LIKE '%%') AND (CC.BillPost LIKE '%'
> OR CC.BillPost IS NULL) AND (CC.DateCreate BETWEEN '1/1/1900 12:00:00 AM'
> AND '1/4/2006 11:59:59 PM') AND (CC.CusMisc1 LIKE '%' OR CC.CusMisc1 IS
> NULL) AND (RCC.Hot LIKE '%') AND CC.CusId NOT IN (SELECT CC.CusId FROM
COCUS
> AS CC INNER JOIN CONOTITM AS CNI ON CC.NotId = CNI.NotId WHERE
> (CNI.DateUpdate BETWEEN '12/5/2005 12:00:00 AM' AND '1/4/2006 11:59:59
PM')
> AND (CNI.Des IS NOT NULL) AND (CNI.Des <> '')) AND CC.CusId NOT IN (SELECT
> CC.CusId FROM COCUS AS CC INNER JOIN RDKCALLHIST AS RCH ON CC.CusId => RCH.CusId WHERE (RCH.DateCall BETWEEN '12/5/2005 12:00:00 AM' AND
'1/4/2006
> 11:59:59 PM') AND (RCH.Completed = 1)) AND CC.CusId NOT IN (SELECT
CC.CusId
> FROM COCUS AS CC INNER JOIN RDKCOCUS AS RCC ON CC.CusId = RCC.CusId WHERE
> (RCC.PrefEmpIdSpn IS NOT NULL) AND (RCC.PrefEmpIdSpn <> '')) AND CC.CusId
> NOT LIKE '[&]%'
> with no traffic and running the statement directly on the server takes
about
> 10 seconds to complete.
> does anyone have any information on server performance if i break up the
131
> columns into more tables?
> someone told me this may help but i need actual performance information
> before i start that job :)
> thank you,
> abraham luna
>|||"Abraham Andres Luna" <abe@.rdk.com> wrote in message
news:%23bcuT8wEGHA.868@.TK2MSFTNGP10.phx.gbl...
> hello everyone,
> i wasn't sure which sql newsgroup to post this question and server sounds
> generic enough
> i have a table named RDKCOCUS with 131 columns and over 44k records
> sometimes the server will timeout when i select using this statement:
> SELECT COUNT(CC.CusId) AS TOTALROWS FROM COCUS AS CC INNER JOIN RDKCOCUS
> AS RCC ON CC.CusId = RCC.CusId WHERE (CC.CusId LIKE '%%') AND (CC.Name
> LIKE '%%') AND (CC.Post LIKE '%' OR CC.Post IS NULL) AND (CC.Contact LIKE
> '%' OR CC.Contact IS NULL) AND (CC.BillCusId LIKE '%%') AND (CC.BillPost
> LIKE '%' OR CC.BillPost IS NULL) AND (CC.DateCreate BETWEEN '1/1/1900
> 12:00:00 AM' AND '1/4/2006 11:59:59 PM') AND (CC.CusMisc1 LIKE '%' OR
> CC.CusMisc1 IS NULL) AND (RCC.Hot LIKE '%') AND CC.CusId NOT IN (SELECT
> CC.CusId FROM COCUS AS CC INNER JOIN CONOTITM AS CNI ON CC.NotId => CNI.NotId WHERE (CNI.DateUpdate BETWEEN '12/5/2005 12:00:00 AM' AND
> '1/4/2006 11:59:59 PM') AND (CNI.Des IS NOT NULL) AND (CNI.Des <> '')) AND
> CC.CusId NOT IN (SELECT CC.CusId FROM COCUS AS CC INNER JOIN RDKCALLHIST
> AS RCH ON CC.CusId = RCH.CusId WHERE (RCH.DateCall BETWEEN '12/5/2005
> 12:00:00 AM' AND '1/4/2006 11:59:59 PM') AND (RCH.Completed = 1)) AND
> CC.CusId NOT IN (SELECT CC.CusId FROM COCUS AS CC INNER JOIN RDKCOCUS AS
> RCC ON CC.CusId = RCC.CusId WHERE (RCC.PrefEmpIdSpn IS NOT NULL) AND
> (RCC.PrefEmpIdSpn <> '')) AND CC.CusId NOT LIKE '[&]%'
> with no traffic and running the statement directly on the server takes
> about 10 seconds to complete.
> does anyone have any information on server performance if i break up the
> 131 columns into more tables?
>
Don't do that for performance reasons (there may well be design reasons to
do it). For performance, proper indexing can do just as well. For
instance, of your 133 columns you only use:
(CusId, Hot, PrefEmpIdSpn, PrefEmpIdSpn). And CusID is used in the join.
So I would start with an index on these.
create index ix_CustIDxxx on RDKCOCUS(CusId, Hot, PrefEmpIdSpn,
PrefEmpIdSpn)
This will let SQL aviod your large, wide table, and hit only a small, narrow
index structure. If you are on SQL 2005 you might just make this an index
on CusID with INCLUDED COLUMNS (Hot, PrefEmpIdSpn, PrefEmpIdSpn). It will
serve the same purpose, but will be smaller.
David|||"d" <d@.d.com> wrote in message news:uAGvf.451$ww5.34@.trnddc01...
> I'm surprised you get timeouts. This is a very, very nasty query.
> Don't break the tables. Breakup the query into stages. Work on creating
> cleaner code.
> d.
>
Hmm. The code's not too bad. Obviously "autogenerated", but it's pretty
clean. Here it is formatted reasonably:
SELECT
COUNT(CC.CusId) AS TOTALROWS
FROM COCUS AS CC
INNER JOIN RDKCOCUS AS RCC
ON CC.CusId = RCC.CusId
WHERE (CC.CusId LIKE '%%')
AND (CC.Name LIKE '%%')
AND (CC.Post LIKE '%' OR CC.Post IS NULL)
AND (CC.Contact LIKE '%' OR CC.Contact IS NULL)
AND (CC.BillCusId LIKE '%%')
AND (CC.BillPost LIKE '%' OR CC.BillPost IS NULL)
AND (CC.DateCreate BETWEEN '1/1/1900 12:00:00 AM' AND '1/4/2006 11:59:59
PM')
AND (CC.CusMisc1 LIKE '%' OR CC.CusMisc1 IS NULL)
AND (RCC.Hot LIKE '%')
AND CC.CusId NOT IN
(
SELECT CC.CusId
FROM COCUS AS CC
INNER JOIN CONOTITM AS CNI
ON CC.NotId = CNI.NotId
WHERE (CNI.DateUpdate BETWEEN '12/5/2005 12:00:00 AM' AND '1/4/2006
11:59:59 PM')
AND (CNI.Des IS NOT NULL)
AND (CNI.Des <> '')
)
AND CC.CusId NOT IN
(
SELECT CC.CusId
FROM COCUS AS CC
INNER JOIN RDKCALLHIST AS RCH
ON CC.CusId = RCH.CusId
WHERE (RCH.DateCall BETWEEN '12/5/2005 12:00:00 AM' AND '1/4/2006
11:59:59 PM')
AND (RCH.Completed = 1)
)
AND CC.CusId NOT IN
(
SELECT CC.CusId
FROM COCUS AS CC
INNER JOIN RDKCOCUS AS RCC
ON CC.CusId = RCC.CusId
WHERE (RCC.PrefEmpIdSpn IS NOT NULL)
AND (RCC.PrefEmpIdSpn <> '')
)
AND CC.CusId NOT LIKE '[&]%'
Breaking a query up into stages assumes that you "know better" than SQL how
to execute the query, and you can often shoot yourself in the foot.
David