Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Tuesday, March 27, 2012

database blocked - URGENT!!

Hi guys,

we have a database here and something happened which causes a database block. We tried to run the 'sp_who' 'active' command to see the spid which locked the database, and we found out that some transaction is blocking another transaction. The following is the sample data results from the sp_who 'active'

spid ecid status loginame hostname blk dbname cmd

52 0 sleeping HOSTING\SQLMonitor BLUE2 185 tempdb INSERT
53 0 sleeping sa 10.10.10.106 185 mfgq_live SELECT
56 0 sleeping sa 10.10.10.106 175 mfgq_live UPDATE
57 0 sleeping sa 10.10.10.143 185 mfgq_live SELECT

We killed all spid which casuse the blocking, but they are keep on coming.

Does anybody have any idea on what casuses this problem or a teporary solution for this? Please help.

Thx

To find the cause, you need to find the lead blocker (the first spid that starts the blocking chain), find out what that spid is executing and take a look at the locks the spid is taking out on whatever objects and then you go from there. The following article will walk you through the process to do this:

http://support.microsoft.com/?id=224453

-Sue

Wednesday, March 21, 2012

database backup file size

How does backup database command works? I don't see size of database backup file increasing while backup is in progress OR is it locked till the backup is finished.
Thanks.The size of the backup file (or files) is pre-calculated and the space is allocated before the actual backup starts. You will not see the size change while the backup is running.sql

Database Backup

Hi,

I want to know how to take a database backup in sqlexpress from command line. Can some one help me?

Thanks.

At it's most simple, you'd use something like this:

SQLCmd -S .\SQLEXPRESS -E -Q "BACKUP DATABASE AdventureWorks TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\AdventureWorks.bak'"

This isn't teribly flexible or robust, so you're more likely going to want to write a backup script and call that script file rather than just typing in a simple T-SQL command. Read the BOL topic on BACKUP for information about the various options. You can find a general overview of database backup here.

Jasper Smith, one of the SQL Server MVPs, has put together a tool called ExpressMaint that will help you create a script to do maintenance tasks, including backup, check it out.

Mike

|||Thanks.

Sunday, February 19, 2012

Data type problem

Greetings SSIS friends,

I cast one of my fields from a decimal to an int in my data source (generated from a SQL command). But when I try and map that field to another one of my tables, i get an error saying that I can not cvonvert from decimal to Int32.

Is there any solution which doest require using the derived column or data conversion components?!

Your help would be appreciated.

Can you provide your SQL so that we can look at it? If you are casting to an integer from a decimal in the SQL, SSIS should only see an integer...|||

Hi Phil,

That's what I don't understand.

The SQL is pretty straightforward to be honest.

select
distinct
b.eventid as evt_eventid,
b.meetid as evt_meetid,
cast(h.longname as varchar) as evt_long_name,
cast(h.shortname as varchar) as evt_source_short_name,
b.expstartdate as evt_expstartdate,
b.expstarttime as evt_expstarttime,
b.eventnumber as evt_eventnumber,
b.expertgroup as evt_expertgroup,
b.currentrun as evt_currentrun,
b.enddate as evt_enddate,
b.endtime as evt_endtime,
b.eventstatus as evt_eventstatus,
f.etypeid evt_etypeid,
cast(g.longname as varchar) as evt_type_long_name,
cast(h.longname as varchar) as evt_name,
b.maxplaces as evt_maxplaces,
b.maxpayout as evt_specific_maxpayout,
f.maxpayout as evt_default_type_maxpayout,
b.offdate as evt_offdate,
b.offtime as evt_offtime,
cast(b.callitap as char(1)) as evt_callitap,
cast(isnull(b.maxstake, 0) as int) as evt_maxstake,
b.scoop6leg as evt_scoop6leg,
b.riskoff as evt_riskoff,
b.userofftime as evt_userofftime,
b.delayofftime as evt_delayofftime,
cast(b.suspendliability as int) as evt_suspendliability,
b.termsid as evt_specific_termsid,
i.termsid as evt_default_termsid,
cast(j.longname as varchar) as evt_default_terms,
cast(l.longname as varchar) as specific_evt_terms,
convert(varchar(20), convert(bigint, b.updatetimestamp)) as evt_updatetimestamp
from meetings as a
inner join events as b
on a.meetid = b.meetid
inner join names as c
on a.nameid = c.nameid
inner join EvenType as d
on a.etypeid = d.etypeid
inner join names as e
on d.nameid = e.nameid
inner join EvenType as f
on b.etypeid = f.etypeid
inner join names as g
on f.nameid = g.nameid
inner join names as h
on b.nameid = h.nameid
inner join terms as i
on f.termsid = i.termsid
inner join names as j
on i.nameid = j.nameid
left join terms as k
on b.termsid = k.termsid
left join names as l
on k.nameid = l.nameid
where
convert(varchar(20), convert(bigint, a.updatetimestamp)) > ?
or convert(varchar(20), convert(bigint, b.updatetimestamp)) > ?

order by b.meetid, b.eventid

In SSIS however, it still thinks the column is a decimal.

|||Did you previously have the decimal coming into the source and then later changed the SQL to cast it to an integer?

In the source column mappings, delete the row that corresponds to the column you are working with, and re-map it. Does that help?|||

Hi Phil,

Yes you are right. I unmapped the column and then remaped it and reconfigured my other merge joins and it is now in the data type that I cast it in the SQL code.

Thanks for your help.

Tuesday, February 14, 2012

Data Transformation - hanging

I'm running a DTS package on SQL Server. The source is MS Access and the
target is Oracle.

On a "Drop Table" command the process just hangs. There are no foreign keys on
the table. Several tables have already been processed successfully by this
time.

I think I've ruled out corruption by dropping and recreating the target
database on Oracle.

Any ideas?

M ManHi

There may be some lock on the table from a different process. I assume that
you are using this as a temporary table, therefore why not create these in
your SQL Server database rather than the destination one?

John

"MMan37x" <mman37x@.cs.com> wrote in message
news:20041015203641.02596.00002058@.mb-m13.news.cs.com...
> I'm running a DTS package on SQL Server. The source is MS Access and the
> target is Oracle.
> On a "Drop Table" command the process just hangs. There are no foreign
keys on
> the table. Several tables have already been processed successfully by
this
> time.
> I think I've ruled out corruption by dropping and recreating the target
> database on Oracle.
> Any ideas?
> M Man