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

Friday, March 30, 2012

how can i connect with lank password

hi all
i setup my sqlserver2000 on win 2000 and let him to take username and password from windows
so how can i connect to it with blank uid,pwd?
thanxYou can use trusted connection as :
"Server=Aron1;Database=pubs;Trusted_Connection=True;"

FYI: http://www.connectionstrings.com

Regards,|||thanx alot|||hello aain
i tried to connect but an eror msg appears:
Exception Occurred: Login failed for user 'COMPU-DSW51C8DZ\ASPNET'.

i'm using this code:

SqlConnection cn;
SqlCommand cm;
String strSQL;

cn = new SqlConnection ("server=localhost;database=Northwind;Trusted_Connection=true;");
strSQL = "INSERT INTO Employees " +
"(EmployeeID,FirstName,LastName,City) " +
"VALUES ('" + txtID.Text + "', '" +
txtFirstName.Text + "', '" +
txtLastName.Text + "', '" +
ChkToInt(chkCity) + "')";

cm = new SqlCommand(strSQL, cn);

// ** Open connection
try
{
cn.Open();
// ** Execute command
cm.ExecuteNonQuery();
}
catch(SqlException sx)
{
Response.Write("Exception Occurred: " + sx.Message);
}
finally
{
if (cn.State == ConnectionState.Open)
cn.Close();
}|||This means you need to set up COMPU-DSW51C8DZ\ASPNET as a login in SQL Server.

Do you have Query Analyzer? Running this will create the login:

exec sp_grantlogin 'COMPU-DSW51C8DZ\ASPNET'

And running this will give permission to the database:
exec sp_grantdbaccess 'COMPU-DSW51C8DZ\ASPNET'

Make sure that northwind is the current database before running executing sp_grantdbaccess.

Terri

Friday, March 23, 2012

How can I back up a log-shipped database?

(SQL Server 2000, SP3a)
Hello all!
I've got a database that is the secondary server in a log-shipped pair. Whe
never I try
and do a BACKUP on this database, I get an error message that the database i
s in a
READ-ONLY STANDBY mode.
Is there any way to circumvent this, temporarily, and make a database backup
of a
log-shipped database?
Thanks!Hi,
Just for my benefit, what would be the purpose of backing up a database that
does not change? I assume that the secondary DB of the pair resides in DR an
d
as a result the site will be protected (fire proof etc.) secondly the
Database in the prod environment is being backed up and the backups are sent
off site.
- You might want to consider Replication over logshipping of you really must
backup the secondary DB .
"John Peterson" wrote:

> (SQL Server 2000, SP3a)
> Hello all!
> I've got a database that is the secondary server in a log-shipped pair. W
henever I try
> and do a BACKUP on this database, I get an error message that the database
is in a
> READ-ONLY STANDBY mode.
> Is there any way to circumvent this, temporarily, and make a database back
up of a
> log-shipped database?
> Thanks!
>
>|||Hello Olu!
We had hoped to be able to grab some of these Production databases for Dev a
nd QE testing.
It'd be more convenient to grab them from our DR environment (the log-shippe
d environment)
because it's already on our corporate network. But, I see that it's proving
to be more of
a challenge than we had hoped. ;-)
Out of curiosity, how would I configure Replication over log-shipping? Does
that mean I'd
set up a log-shipped DB as the Replication Publisher? I would have thought
that couldn't
be done on a read-only DB...
At this point, I'm kind of considering using DTS and the Transfer Database T
ask to
accomplish what I want. Some of the DBs are big, and I hate the thought of
essentially
BCPing everything out, but it *does* appear to work...
"Olu Adedeji" <OluAdedeji@.discussions.microsoft.com> wrote in message
news:C91B47A6-F4D2-4599-819F-D87924CE42D7@.microsoft.com...[vbcol=seagreen]
> Hi,
> Just for my benefit, what would be the purpose of backing up a database th
at
> does not change? I assume that the secondary DB of the pair resides in DR
and
> as a result the site will be protected (fire proof etc.) secondly the
> Database in the prod environment is being backed up and the backups are se
nt
> off site.
> - You might want to consider Replication over logshipping of you really mu
st
> backup the secondary DB .
> "John Peterson" wrote:
>|||Well, *shoot*! As it turns out, the DTS "Transfer Databases Task" will brin
g a DB out of
RECOVERY mode. <sigh> So that's a no go. :-(
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:eCi9jeCkEHA.2652@.TK2MSFTNGP15.phx.gbl...
> Hello Olu!
> We had hoped to be able to grab some of these Production databases for Dev
and QE
> testing. It'd be more convenient to grab them from our DR environment (the
log-shipped
> environment) because it's already on our corporate network. But, I see th
at it's
> proving to be more of a challenge than we had hoped. ;-)
> Out of curiosity, how would I configure Replication over log-shipping? Do
es that mean
> I'd set up a log-shipped DB as the Replication Publisher? I would have th
ought that
> couldn't be done on a read-only DB...
> At this point, I'm kind of considering using DTS and the Transfer Database
Task to
> accomplish what I want. Some of the DBs are big, and I hate the thought o
f essentially
> BCPing everything out, but it *does* appear to work...
>
> "Olu Adedeji" <OluAdedeji@.discussions.microsoft.com> wrote in message
> news:C91B47A6-F4D2-4599-819F-D87924CE42D7@.microsoft.com...
>

How can I avoid table lock in SQL2000?

To any and all;

I have a very large table (16Mil+ records), for which I want to delete
about 8 Million records. There are a few indexes on this table.

Is there a way that I can run either a query or a series of queries
that will run against each record and delete based on criteria (date)?
If I do a single DELETE query, it will take forever, lock the table,
and my app that runs against it will stop INSERTING, which is bad.

If I do a cursor, I think it locks the table also, so that won't do,
right?

Any help would be appreciated.

Glenn Dekhayser
Contentcatcher.comOn 15 Feb 2005 13:19:01 -0800, "gdekhayser" <gdekhayser@.voyantinc.com> wrote:

>To any and all;
>I have a very large table (16Mil+ records), for which I want to delete
>about 8 Million records. There are a few indexes on this table.
>Is there a way that I can run either a query or a series of queries
>that will run against each record and delete based on criteria (date)?
> If I do a single DELETE query, it will take forever, lock the table,
>and my app that runs against it will stop INSERTING, which is bad.
>If I do a cursor, I think it locks the table also, so that won't do,
>right?
>Any help would be appreciated.
>Glenn Dekhayser
>Contentcatcher.com

With a table that size, have you thought of partitioning it by date? Then,
locks would be held only on the partition(s) that overlap the date range you
are deleting.|||Right, but I need to deal with the records in place before I can do
that...don't I? Once I get the table down in size to something
rational, then I can partition it...|||gdekhayser (gdekhayser@.voyantinc.com) writes:
> I have a very large table (16Mil+ records), for which I want to delete
> about 8 Million records. There are a few indexes on this table.
> Is there a way that I can run either a query or a series of queries
> that will run against each record and delete based on criteria (date)?
> If I do a single DELETE query, it will take forever, lock the table,
> and my app that runs against it will stop INSERTING, which is bad.
> If I do a cursor, I think it locks the table also, so that won't do,
> right?

First of all, if there is no index on this date column, you can never
avoid the table lock.

If there is a clustered index on the date column, you should be able
to say DELETE tbl "WHERE date < @.somedateinthepast" and still have
your insertes coming through. Then again, if you delete day by day,
it may still be leaner.

If there is a non-clustered index on date, it depends on how many
rows there are per date. If there are too many rows per date, a
DELETE per date could table-scan. You could force an index, but
plenty of rows would be locked, for some time.

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

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||For the future, you should consider partitioning , as deleting n
records is o(n) while dropping a table (or truncating it) is O(1).

For now , I would recommend deleting with rowcount< some number ,
probably in the low thousands, which should leave the table in a fairly
operational state while you do it.

Of course after such a massive delete, the table will be in a terribly
fragmented state internally, so the next step is to rebuild the
indexes.

another alternative is to create another table with the same schema but
without the indexes, insert into it the rows that you do want to keep
(the complement of the 'to be deleted') and then build the indexes. you
can then drop the old table and rename the new one.

hope this helps
Tzvika

gdekhayser wrote:
> To any and all;
> I have a very large table (16Mil+ records), for which I want to
delete
> about 8 Million records. There are a few indexes on this table.
> Is there a way that I can run either a query or a series of queries
> that will run against each record and delete based on criteria
(date)?
> If I do a single DELETE query, it will take forever, lock the table,
> and my app that runs against it will stop INSERTING, which is bad.
> If I do a cursor, I think it locks the table also, so that won't do,
> right?
> Any help would be appreciated.
> Glenn Dekhayser
> Contentcatcher.com|||Erland- I wish I would have read your post earlier. I would have
thought that removing the indexes would make the delete faster. I
goofed and left the 4 indexes in place, the date one wasn't clustered.
I really wouldn't have cared about the row locks if I forced an index,
as they were going to be deleted anyway and not accessed.

I ended up just performing the delete- and watching my logs grow REAL
large.

I now have 3 log files where I really only want one- is there a way to
condense back into one log file when you're split into 3?|||gdekhayser (gdekhayser@.voyantinc.com) writes:
> Erland- I wish I would have read your post earlier. I would have
> thought that removing the indexes would make the delete faster.

Yeah, removing the indexes not useful for the DELETE would have speedied
things up a little. It may not be a good idea to drop the clustered index
though.

> I ended up just performing the delete- and watching my logs grow REAL
> large.
> I now have 3 log files where I really only want one- is there a way to
> condense back into one log file when you're split into 3?

Well, you can say ALTER DATABASE REMOVE FILE, but you would have to
truncate the log first. Maybe the best is to use WITH TRUNCATE_ONLY
and the take a full backup of the database. I guess that then you
should be able to remove some of the files.

But I will have to admit that I have never had reason to drop a log
file, so I am just speculating here.

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

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