Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Monday, March 19, 2012

Database marked as suspect please HELP!

Hi,

I restored my Windows XP system and discovered that I cannot access a
MSDE DB that was saved in D: drive (I restored my primary partition in
C). How can I restore it?
Thanks a lot.did you try reattaching it ?|||On 6 Jan 2005 10:25:09 -0800, "getinked" <glenn@.imsocial.com> wrote:

>did you try reattaching it ?

How can I do that? I have the MDF and LDF files but I've never done a
backup. I'm using the trial version of Teratrax Database Manager and
DbaMGR2K.
Thanks a lot for your help.|||On 6 Jan 2005 10:25:09 -0800, "getinked" <glenn@.imsocial.com> wrote:

>did you try reattaching it ?

I noticed the attach command in Teratrax but don't know how to use it.
It tells me

sp_attach_db 'database_name', 'file_name_and_path_relative_to_server'

Is the database_name the filename? What's the relative path? I've my
DB saved in D:\database while the server is in C:\InetPub I think.
Thanks.|||yea the relative path would be where you are storing the data...thus
being on your D drive.|||On 6 Jan 2005 13:23:38 -0800, "getinked" <glenn@.imsocial.com> wrote:

>yea the relative path would be where you are storing the data...thus
>being on your D drive.

Could you be more specific, what string should I enter? Thanks.|||kurotsuke (kurotsuke@.yahoo.it) writes:
> On 6 Jan 2005 13:23:38 -0800, "getinked" <glenn@.imsocial.com> wrote:
>>yea the relative path would be where you are storing the data...thus
>>being on your D drive.
> Could you be more specific, what string should I enter? Thanks.

The exact path to where the database file is located. (The Send To Cliboard
as Name from the Win95 Powertoys comes in extremely handy here.) For
instance D:\Program Files\Microsoft SQL Server\MSSQL\Data\yourdatabase.mdf.
Note that you have two files to enter: the .MDF and the .LDF.

However, since your database is marked as suspect, it still attached
to SQL Server in some sense. You may have to drop it first. Then again,
you could attach the database under a new name.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

DATABASE marked "SUSPECT" - How to restore?

Recently after I rebooted the MS SQL server, the "cdr"
database is marked with "Suspect" in the Enterprise
Manager,and when I try to access the database, the
Enterprise Manager prompted that the database is marked
as "Suspect" and inaccessible. When looked into the
MSSQL\data folder, the .MDB file and LDF is still there.
Strongly believe this is because there was a torn page
happened(because I restarted the server when the pc hung).
The cdr database contain our latest 3 months call records
and it is up to 22G of data. The bad new is, no backup had
been done to restore the data. I've tried to use
sp_attach_db, recreate database and all other method to
restore the data, still failed to restore the data. Since
the MDF file is preserved, hopefully there is a method to
restore the database.hey have a look at this website,
http://www.spaceprogram.com/knowledge/sqlserver_recover_fro
m_deleted_log.html
>--Original Message--
>Recently after I rebooted the MS SQL server, the "cdr"
>database is marked with "Suspect" in the Enterprise
>Manager,and when I try to access the database, the
>Enterprise Manager prompted that the database is marked
>as "Suspect" and inaccessible. When looked into the
>MSSQL\data folder, the .MDB file and LDF is still there.
>Strongly believe this is because there was a torn page
>happened(because I restarted the server when the pc
hung).
>The cdr database contain our latest 3 months call records
>and it is up to 22G of data. The bad new is, no backup
had
>been done to restore the data. I've tried to use
>sp_attach_db, recreate database and all other method to
>restore the data, still failed to restore the data. Since
>the MDF file is preserved, hopefully there is a method to
>restore the database.
>.
>|||Hi,
I got these from another newsgroup several months ago and
they have worked on three suspect databases since. I
generally only need to run the DBCC rebuild_log and then
run a DBCC CheckDB to make sure the database is not
corrupt. Hope they help.
1) Make sure you have a copy of your.MDF
2) Create a new database called fake (default file
locations)
3) Stop SQL Service
4) Delete the fake_Data.MDF and copy your.MDF to where
fake_Data.MDF used
to
be and rename the file to fake_Data.MDF
5) Start SQL Service
6) Database fake will appear as suspect in EM
7) Open Query Analyser and in master database run the
following :
sp_configure 'allow updates',1
go
reconfigure with override
go
update sysdatabases set
status=-32768 where dbid=DB_ID('fake')
go
sp_configure 'allow updates',0
go
reconfigure with override
go
This will put the database in emergency recovery mode
8) Stop SQL Service
9) Delete the fake_Log.LDF file
10) Restart SQL Service
11) In QA run the following (with correct path for log)
dbcc rebuild_log('fake','h:\fake_log.ldf')
go
dbcc checkdb('fake') -- to check for errors
go
12) Now we need to rename the files, run the following
(make sure there
are
no connections to it) in Query Analyzer (At this stage
you can actually
access the database so you could use DTS or bcp to move
the data to
another
database).
use master
go
sp_helpdb 'fake'
go
/* Make a note of the names of the files , you will
need them
in the next bit of the script to replace datafilename
and
logfilename - it might be that they have the right
names */
sp_renamedb 'fake','your'
go
alter database your
MODIFY FILE(NAME='datafilename', NEWNAME
= 'your_data')
go
alter database PowerDVD301
MODIFY FILE(NAME='logfilename', NEWNAME
= 'your_Log')
go
dbcc checkdb('your')
go
sp_dboption 'your','dbo use only','false'
go
use PowerDVD301
go
sp_updatestats
go
13) You should now have a working database. However the
log file will be
small so it will be worth increasing its size.
Unfortunately your files
will
be called fake_Data.MDF and fake_Log.LDF but you can get
round this by
detaching thedatabase properly and then renaming the
files and reattaching
it.
14) Run the following in QA
sp_detach_db your
--now rename the files then reattach
sp_attach_db 'your','your.mdf','your.ldf'
>--Original Message--
>Recently after I rebooted the MS SQL server, the "cdr"
>database is marked with "Suspect" in the Enterprise
>Manager,and when I try to access the database, the
>Enterprise Manager prompted that the database is marked
>as "Suspect" and inaccessible. When looked into the
>MSSQL\data folder, the .MDB file and LDF is still there.
>Strongly believe this is because there was a torn page
>happened(because I restarted the server when the pc
hung).
>The cdr database contain our latest 3 months call records
>and it is up to 22G of data. The bad new is, no backup
had
>been done to restore the data. I've tried to use
>sp_attach_db, recreate database and all other method to
>restore the data, still failed to restore the data. Since
>the MDF file is preserved, hopefully there is a method to
>restore the database.
>.
>|||Be warned - rebuilding your log is extremely dangerous and UNSUPPORTED (i.e.
you're on your own when it goes wrong - which it can very easily do).
This command commonly results in large amounts of lost data and, much more
seriously, loss of all transactional consistency in your database (i.e. did
that update transaction to a customer's bank account happen or not? there is
no way to tell).
If your business can cope with that, fine.
Microsoft strongly recommends that you DO NOT use this command or the
procedures documented below.
Regards,
Paul.
--
Paul Randal
DBCC Technical Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Wayne Antinore" <wantinore@.veramark.com> wrote in message
news:0e8601c38cc6$5092d840$a301280a@.phx.gbl...
> Hi,
> I got these from another newsgroup several months ago and
> they have worked on three suspect databases since. I
> generally only need to run the DBCC rebuild_log and then
> run a DBCC CheckDB to make sure the database is not
> corrupt. Hope they help.
> 1) Make sure you have a copy of your.MDF
> 2) Create a new database called fake (default file
> locations)
> 3) Stop SQL Service
> 4) Delete the fake_Data.MDF and copy your.MDF to where
> fake_Data.MDF used
> to
> be and rename the file to fake_Data.MDF
> 5) Start SQL Service
> 6) Database fake will appear as suspect in EM
> 7) Open Query Analyser and in master database run the
> following :
> sp_configure 'allow updates',1
> go
> reconfigure with override
> go
> update sysdatabases set
> status=-32768 where dbid=DB_ID('fake')
> go
> sp_configure 'allow updates',0
> go
> reconfigure with override
> go
> This will put the database in emergency recovery mode
> 8) Stop SQL Service
> 9) Delete the fake_Log.LDF file
> 10) Restart SQL Service
> 11) In QA run the following (with correct path for log)
> dbcc rebuild_log('fake','h:\fake_log.ldf')
> go
> dbcc checkdb('fake') -- to check for errors
> go
> 12) Now we need to rename the files, run the following
> (make sure there
> are
> no connections to it) in Query Analyzer (At this stage
> you can actually
> access the database so you could use DTS or bcp to move
> the data to
> another
> database).
> use master
> go
> sp_helpdb 'fake'
> go
> /* Make a note of the names of the files , you will
> need them
> in the next bit of the script to replace datafilename
> and
> logfilename - it might be that they have the right
> names */
> sp_renamedb 'fake','your'
> go
> alter database your
> MODIFY FILE(NAME='datafilename', NEWNAME
> = 'your_data')
> go
> alter database PowerDVD301
> MODIFY FILE(NAME='logfilename', NEWNAME
> = 'your_Log')
> go
> dbcc checkdb('your')
> go
> sp_dboption 'your','dbo use only','false'
> go
> use PowerDVD301
> go
> sp_updatestats
> go
> 13) You should now have a working database. However the
> log file will be
> small so it will be worth increasing its size.
> Unfortunately your files
> will
> be called fake_Data.MDF and fake_Log.LDF but you can get
> round this by
> detaching thedatabase properly and then renaming the
> files and reattaching
> it.
> 14) Run the following in QA
> sp_detach_db your
> --now rename the files then reattach
> sp_attach_db 'your','your.mdf','your.ldf'
>
> >--Original Message--
> >Recently after I rebooted the MS SQL server, the "cdr"
> >database is marked with "Suspect" in the Enterprise
> >Manager,and when I try to access the database, the
> >Enterprise Manager prompted that the database is marked
> >as "Suspect" and inaccessible. When looked into the
> >MSSQL\data folder, the .MDB file and LDF is still there.
> >Strongly believe this is because there was a torn page
> >happened(because I restarted the server when the pc
> hung).
> >The cdr database contain our latest 3 months call records
> >and it is up to 22G of data. The bad new is, no backup
> had
> >been done to restore the data. I've tried to use
> >sp_attach_db, recreate database and all other method to
> >restore the data, still failed to restore the data. Since
> >the MDF file is preserved, hopefully there is a method to
> >restore the database.
> >.
> >

Friday, February 24, 2012

Database Mail definition - confusing

Hello,
>From BOL:
For improved security, Database Mail manages access to mail profiles. A
profile may be public or private. Public profiles are available for all
members of the DatabaseMailUserRole database role in the msdb database.
They allow all members of the DatabaseMailUserRole role to send e-mail
using the profile.
To use a private profile, sysadmin must grant users permission to use
the profile. In addition, execute permission on the sp_send_dbmail
stored procedure is only granted to members of the
DatabaseMailUserRole. A system administrator must add the user to the
DatabaseMailUserRole database role in order for the user to send
e-mails.
What's confusing that that DatabaseMailUserRole is a PUBLIC role.
However, if you create a private profile, it says you must add the user
to the DatabaseMailUserRole in order for the user to send emails. That
would make the any member of this role a public profile?
I guess I am confused about the language here, so in effect I have no
clue what the end result of adding a user from a PRIVATE profile into a
role that is available for PUBLIC profiles.Hi
If I have interpreted your interpretation right, I think there is some
confusion between a role which is not a fixed database role, and the public
database role.
John
"tootsuite@.gmail.com" wrote:
> Hello,
> >From BOL:
> For improved security, Database Mail manages access to mail profiles. A
> profile may be public or private. Public profiles are available for all
> members of the DatabaseMailUserRole database role in the msdb database.
> They allow all members of the DatabaseMailUserRole role to send e-mail
> using the profile.
> To use a private profile, sysadmin must grant users permission to use
> the profile. In addition, execute permission on the sp_send_dbmail
> stored procedure is only granted to members of the
> DatabaseMailUserRole. A system administrator must add the user to the
> DatabaseMailUserRole database role in order for the user to send
> e-mails.
> What's confusing that that DatabaseMailUserRole is a PUBLIC role.
> However, if you create a private profile, it says you must add the user
> to the DatabaseMailUserRole in order for the user to send emails. That
> would make the any member of this role a public profile?
> I guess I am confused about the language here, so in effect I have no
> clue what the end result of adding a user from a PRIVATE profile into a
> role that is available for PUBLIC profiles.
>

Database Mail definition - confusing

Hello,

>From BOL:
For improved security, Database Mail manages access to mail profiles. A
profile may be public or private. Public profiles are available for all
members of the DatabaseMailUserRole database role in the msdb database.
They allow all members of the DatabaseMailUserRole role to send e-mail
using the profile.
To use a private profile, sysadmin must grant users permission to use
the profile. In addition, execute permission on the sp_send_dbmail
stored procedure is only granted to members of the
DatabaseMailUserRole. A system administrator must add the user to the
DatabaseMailUserRole database role in order for the user to send
e-mails.
What's confusing that that DatabaseMailUserRole is a PUBLIC role.
However, if you create a private profile, it says you must add the user
to the DatabaseMailUserRole in order for the user to send emails. That
would make the any member of this role a public profile?
I guess I am confused about the language here, so in effect I have no
clue what the end result of adding a user from a PRIVATE profile into a
role that is available for PUBLIC profiles.Hi
If I have interpreted your interpretation right, I think there is some
confusion between a role which is not a fixed database role, and the public
database role.
John
"tootsuite@.gmail.com" wrote:

> Hello,
>
> For improved security, Database Mail manages access to mail profiles. A
> profile may be public or private. Public profiles are available for all
> members of the DatabaseMailUserRole database role in the msdb database.
> They allow all members of the DatabaseMailUserRole role to send e-mail
> using the profile.
> To use a private profile, sysadmin must grant users permission to use
> the profile. In addition, execute permission on the sp_send_dbmail
> stored procedure is only granted to members of the
> DatabaseMailUserRole. A system administrator must add the user to the
> DatabaseMailUserRole database role in order for the user to send
> e-mails.
> What's confusing that that DatabaseMailUserRole is a PUBLIC role.
> However, if you create a private profile, it says you must add the user
> to the DatabaseMailUserRole in order for the user to send emails. That
> would make the any member of this role a public profile?
> I guess I am confused about the language here, so in effect I have no
> clue what the end result of adding a user from a PRIVATE profile into a
> role that is available for PUBLIC profiles.
>

Sunday, February 19, 2012

Database Mail

We have a user set up for our .net framework (webuser) with access to a database we created for our website. "webuser" needs to be able to send out emails using Databse Mail (SQL Server 2005) via a stored proc by excuting msdb.dbo.sp_send_dbmail. This stopred proc works fine when I am logged in as administrator but won't work for "webuser" and I can't seem to grant DatabaseMailUserRole to our that user either. What do I need to do?

I have bee trying to find a "how to" on setting this up but have been unsuccessful.

What do you mean by you can't grant? What errors or problems did you have? Did you add the user to msdb and then add the user to the role?

-Sue

|||Hi,
1.) Goto "Databasemail" under Management,
2.) Click on "Manage Profile Security"
3.) Goto "Private profiles" and select the 'webuser' from the dropdown menu and give access to the profile which webuser should use

or else

you can go to the 'public profile', There you can select a profile which can be used as public users and make this as default profile. And call this profile in webapplication to send mail.

Database Mail

We have a user set up for our .net framework (webuser) with access to a database we created for our website. "webuser" needs to be able to send out emails using Databse Mail (SQL Server 2005) via a stored proc by excuting msdb.dbo.sp_send_dbmail. This stopred proc works fine when I am logged in as administrator but won't work for "webuser" and I can't seem to grant DatabaseMailUserRole to our that user either. What do I need to do?

I have bee trying to find a "how to" on setting this up but have been unsuccessful.

What do you mean by you can't grant? What errors or problems did you have? Did you add the user to msdb and then add the user to the role?

-Sue

|||Hi,
1.) Goto "Databasemail" under Management,
2.) Click on "Manage Profile Security"
3.) Goto "Private profiles" and select the 'webuser' from the dropdown menu and give access to the profile which webuser should use

or else

you can go to the 'public profile', There you can select a profile which can be used as public users and make this as default profile. And call this profile in webapplication to send mail.

Database Mail

We have a user set up for our .net framework (webuser) with access to a database we created for our website. "webuser" needs to be able to send out emails using Databse Mail (SQL Server 2005) via a stored proc by excuting msdb.dbo.sp_send_dbmail. This stopred proc works fine when I am logged in as administrator but won't work for "webuser" and I can't seem to grant DatabaseMailUserRole to our that user either. What do I need to do?

I have bee trying to find a "how to" on setting this up but have been unsuccessful.

What do you mean by you can't grant? What errors or problems did you have? Did you add the user to msdb and then add the user to the role?

-Sue

|||Hi,
1.) Goto "Databasemail" under Management,
2.) Click on "Manage Profile Security"
3.) Goto "Private profiles" and select the 'webuser' from the dropdown menu and give access to the profile which webuser should use

or else

you can go to the 'public profile', There you can select a profile which can be used as public users and make this as default profile. And call this profile in webapplication to send mail.

Friday, February 17, 2012

Database log size

hi

my database on remote server i cannot access directly.

i can access it only with query analyzer.

my log file size is 9mb but nothing in database. only few tables there so how i can reduce log file size with query.

thanks

Hi,

I used to do this using the sa privileges.

Google it for (Truncating SQL Log)

Let me know if you need further help.

Regards

|||

Change the recovery model to simple. Set autoshrink to true, back up the database and it should reduce in size.

|||

I don't want you to waste your time, here is the query,

BACKUP LOG databasename WITH TRUNCATE_ONLY
DBCC SHRINKFILE ('databaselog_log', 100) WITH NO_INFOMSGS

It will shrink the log to 100 MB

|||

thanks dear

my problem solved with following

BACKUP LOG databasename WITH TRUNCATE_ONLY
DBCC SHRINKFILE ('databaselog_log', 2) WITH NO_INFOMSGS


DBCC SHRINKFILE(mydatabase)

Database Lock! Urgent Please!

Hello folks!
I'm with two locks on a database and I can't access others databases too, except the master.

I've tryed to kill the lock, but I didn't have sucess.

Please help me!!!
Cheers!
Rafael

SPID DBID OBJID INDID TYPE MODE STATUS
9 5 0 0 DB S GRANT
9 5 0 0 DB X GRANT
51 1 85575343 0 TAB IS GRANTWhat are the spids doing?

Are they yours?

Are you blocking yourself?

Did you look at sp_lock?|||Yes, this spid 9 is me.
But I'm not getting access. I've already disconected.
Take a look on the screenshot|||What do you mean when you say that you can't access other databases?|||I mean that I can't.

When I try to access a database via Entreprise, Query Analyser, etc..
like USE DB_Emplacamentos, DB_Cadastro, whatever, any database on server, my command or my screen keeps trying to connect to the database for the enternity.

I dunno why this is happing. I saw my SQL Server Logs and some erros like this was found:

* Using dynamic lock allocation. [500] Lock Blocks, [1000] Lock Owner Blocks.
* Skipping startup of clean database id 6
* Skipping startup of clean database id 7
* Skipping startup of clean database id 8
* Skipping startup of clean database id 9
* Skipping startup of clean database id 10
* Analysis of database 'DB_Emplacamentos' (5) is 3% complete (approximately 1726 more seconds)

Man, I'm thinking to reinstall the instance of SQL Server and try to restore the database. It is really, really strange.

Cheers!
Rafael|||OK. This looks like SQL 2000. If that is the case, then SPID 9 is not you. Any spid under 50 is a system process. It appears you have just rebooted this machine, and have the "long transaction blues". DB_Emplacamentos will need 20 minutes for just the analysis portion of recovery. Rolling forward, and rolling back could take a bit of time, too. This can happen when you do a lot of re-indexing, then reboot the server (only index creation statements and page allocations, and not all the page changes are recorded in the logs), or if you have an immense transaction that was halfway done when you rebooted. Out of curiosity, how but is DB_Emplacamentos?|||Oh, I imagine you are getting login errors something like "Can not open default database"?|||This database name is like DB_CarIDs.
I have a table with aprox. 45 million rows. It's a little bit big.LOL
The datafiles are around 20GB.

Well, I'll leave the database trying to restabish until tomorrow. If not, I'll start the McGiver's process of reastabilish a 20GB backup.LOL

Thank's for your help. I really appreciate that.

Rafael|||ROLLBACK is like a DOG, always know the way to comeback home!

My databases are allset now!!!
Yeaaah!!!;)

Tks all!

Cheers
Rafael

Tuesday, February 14, 2012

Database Level Security Doubt in SQL6.5

In our SQL Server6.5, I drop a user from in one database using ‘sp_dropuse
r’
command, still with that specific login; I could able to access the database
.
It’s working fine in other database, but its not working only in one datab
ase.
For this login, there is no entries in Sysusers table of the respective
database.
Please help usWhat does 'SELECT USER' return? It may be that the login is mapped to a
different user in that database.
Hope this helps.
Dan Guzman
SQL Server MVP
"Dineshkumar" <Dineshkumar@.discussions.microsoft.com> wrote in message
news:0B35489E-175D-439D-8DF1-295B0B51AEE1@.microsoft.com...
> In our SQL Server6.5, I drop a user from in one database using
> 'sp_dropuser'
> command, still with that specific login; I could able to access the
> database.
> It's working fine in other database, but its not working only in one
> database.
> For this login, there is no entries in Sysusers table of the respective
> database.
> Please help us