Friday, March 9, 2012
I need to rebuild Log file from Master file
Now i have big problem with SQL i lost Log file now i have only master
file . i used recovery to find Log file but not found.
Please tell me how to rebuild Log file from Master file?
Waiting your suport,
Bunthach Eng student of Cambodia (My mail bunthachx@.yahoo.com, My phone
85512 500 382
*** Sent via Developersdex http://www.examnotes.net ***Bunthach Eng wrote:
> Dear sir,
> Now i have big problem with SQL i lost Log file now i have only master
> file . i used recovery to find Log file but not found.
> Please tell me how to rebuild Log file from Master file?
> Waiting your suport,
With master file you mean data file I presume?
Try he following (procedure by Raino Botha):
shutdown sql
move the current database file or rename it
restart sql server
create a new database of the same name and log file and location as the
old database and log file
get rid of the old database. you may be able to right click delete it
in this situation or used sp_removedb
create a new database of the right size and shape with correct log and
data file locations
stop sql
rename the new databases.mdf or delete it if you don't have enough
space - do not touch the .ldf
move back in the old database .mdf file or rename it back again
restart sql server
it should come up suspect
--
1. From a query window, set the status so that you can update the system
tables by running the following query:
use Master
go
sp_configure "allow", 1
go
reconfigure with override
go
2. Then set the status of the DB that is giving you the problem (XXXXX)
into Emergency Mode by running the following query:
update sysdatabases set status = 32768 where name = '<DBName>'
go
checkpoint
go
shutdown with nowait
go
3. Go into the data directory (MSSQL7\DATA) and rename the log file
associated the DB in question (XXXX.ldf) to some temporary name, such
as XXXX.TMP.
4. Exit the query window.
5. Then start up SQL Server from a DOS command window by issuing:
sqlservr -c -T3608 -T4022.
6. Bring up another query window and verify that the DB is in emergency
mode by issuing:
select Name, Status from Sysdatabases where name = '<DB_Name>'
7. Verify that the status is 32768. If it is, then issue the query:
dbcc traceon(3604)
dbcc rebuild_log ('<DB_Name>','<log_filename>') <-- You will need the
quotation marks REBUILD_LOG should take less than 5 minutes even on a
very large
database. It should complete with the message DBCC execution completed
8. Take the database out of bypass recovery mode by issuing the command
update sysdatabases set status = 0 where name = '<DBName>'
9. Exit the query window and then shutdown (Ctrl-C in the DOS window)
and restart SQL server. Verify the status of the database by running
DBCC NEWALLOC and DBCC CHECKDB on the database."
HTH,
Stijn Verrept.|||Stijn
There is no sp_removedb stored procedure. I think you meant DROP DATABASE
...command
"Stijn Verrept" <TURN_moc.tfosyrtne@.njits_AROUND> wrote in message
news:JMadnf956pkAWzXeRVnyrQ@.scarlet.biz...
> Bunthach Eng wrote:
>
> With master file you mean data file I presume?
> Try he following (procedure by Raino Botha):
> shutdown sql
> move the current database file or rename it
> restart sql server
> create a new database of the same name and log file and location as the
> old database and log file
> get rid of the old database. you may be able to right click delete it
> in this situation or used sp_removedb
> create a new database of the right size and shape with correct log and
> data file locations
> stop sql
> rename the new databases.mdf or delete it if you don't have enough
> space - do not touch the .ldf
> move back in the old database .mdf file or rename it back again
> restart sql server
> it should come up suspect
> --
> 1. From a query window, set the status so that you can update the system
> tables by running the following query:
> use Master
> go
> sp_configure "allow", 1
> go
> reconfigure with override
> go
> 2. Then set the status of the DB that is giving you the problem (XXXXX)
> into Emergency Mode by running the following query:
> update sysdatabases set status = 32768 where name = '<DBName>'
> go
> checkpoint
> go
> shutdown with nowait
> go
> 3. Go into the data directory (MSSQL7\DATA) and rename the log file
> associated the DB in question (XXXX.ldf) to some temporary name, such
> as XXXX.TMP.
> 4. Exit the query window.
> 5. Then start up SQL Server from a DOS command window by issuing:
> sqlservr -c -T3608 -T4022.
> 6. Bring up another query window and verify that the DB is in emergency
> mode by issuing:
> select Name, Status from Sysdatabases where name = '<DB_Name>'
> 7. Verify that the status is 32768. If it is, then issue the query:
> dbcc traceon(3604)
> dbcc rebuild_log ('<DB_Name>','<log_filename>') <-- You will need the
> quotation marks REBUILD_LOG should take less than 5 minutes even on a
> very large
> database. It should complete with the message DBCC execution completed
> 8. Take the database out of bypass recovery mode by issuing the command
> update sysdatabases set status = 0 where name = '<DBName>'
> 9. Exit the query window and then shutdown (Ctrl-C in the DOS window)
> and restart SQL server. Verify the status of the database by running
> DBCC NEWALLOC and DBCC CHECKDB on the database."
> --
> HTH,
> Stijn Verrept.|||Uri Dimant wrote:
> Stijn
> There is no sp_removedb stored procedure. I think you meant DROP
> DATABASE ...command
You are right sp_removedb doesn't exist. Well as I said this procedure
isn't mine.
HTH,
Stijn Verrept.
Sunday, February 19, 2012
I need help with my query
Hi Y'all,
I want to get all database-names from my server, i do that like this:
select name, dbid from sysdatabases => from my master database
Now i want to add a "where"-clause to select only those databases that have the table "TASKS".
Can someone help me out?
THanks
Hi,
If you are trying to get the list of tables, database name etc. in your ASP.Net application then have a look at it.http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbconnection.getoledbschematable.aspx
Thanks and best regards,
|||this doesn't seem to work:
SET @.sSql = 'select * from ' + @.databasenaam + '.dbo.sysobjects where name like '''tablesearchnaam''' '
if exists(EXEC sp_sqlexec @.sSql)
SELECT*FROM sysobjectsWHERE [name]LIKE'%tasks%'
This can also be done without using a stored procedure...
IFEXISTS(SELECT*FROM sysobjectsWHERE [name]LIKE'%tasks%')
DO STUFF
If you just want tables you might want to restrict the type to 'U'.
SELECT*FROM sysobjectsWHERE [name]LIKE'%tasks%' AND Type = 'U'
I need backup Master data base?
why?
And What othen ?
ThanksYou need backups of database you want to be able to recover.
So if your system totally crashed and you lost all your
disks, how would you get the system back up and running as
it was before the disks all crashed? You'd need backups of
your system databases (except tempdb) and your user
databases. How often depends upon your business needs,
changes to your system and user data, etc.
You can read about backup and recovery in books online for
whichever version of SQL Server you are running.
-Sue
On Mon, 22 May 2006 11:03:19 -0300, "retf"
<re.tf@.terra.com.br> wrote:
>I need backup Master data base, or only my DB?
>why?
>And What othen ?
>Thanks
>|||Hello,
Agree with Sue and I have included the following articles for your
reference:
INF: Disaster Recovery Articles for Microsoft SQL Server
http://support.microsoft.com/defaul...KB;EN-US;307775
HOW TO: Resolve Permission Issues When You Move a Database Between Servers
That Are Running SQL Server
http://support.microsoft.com/defaul...kb;EN-US;240872
PRB: User Logon and/or Permission Errors After Restoring Dump
http://support.microsoft.com/defaul...kb;EN-US;168001
HOW TO: Move Databases Between Computers That Are Running SQL Server
http://support.microsoft.com/defaul...KB;EN-US;314546
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.