Thursday, March 29, 2012

Equal disk space needed to delete .bak file?

Kind of an obscure question, but here goes.
SQL2000 SP4
I have a E: drive on my SQL server that is ~400gb. On it you'll find
a ~100gb live DB file and last night's 100gb .bak file (maintenance
plan is set for one day retention). The vendor is telling me that I
am going to run out of space doing the SQL backups because 100gb is
used by the live DB, 100gb is used by last nights .bak file, 100gb
will be used to write today's .bak file, and the last 100gb will be
used in the deletion process of removing the old .bak file.
I can't say I know how SQL handles the removal of the old .bak file
but is this a true statement that SQL will need equal free space to
delete the old .bak file?SQL deletes old backups AFTER creating new ones, so you will need space for
at least two backups.
Look at it this way, what happens if your database blows up during a backup.
If you have an older backup, you are fine. If you are overwriting your only
backup, it is time to polish up the resume.
Personally, I would go out and buy a couple of USB drives and back up to
there. Last week my mother purchased a 500GB model for $99. If that is not
an option, you could look into one of the commercially available backup
compression tools. The three major ones are SQLSafe (www.idera.com),
LiteSpeed for SQL (www.quest.com), and SQL Backup (www.red-gate.com).
--
Geoff N. Hiten
Senior SQL Infrastructure Consultant
Microsoft SQL Server MVP
<rockemhard@.gmail.com> wrote in message
news:04b97215-0ec7-4545-a43b-f072fb3c47a2@.e6g2000prf.googlegroups.com...
> Kind of an obscure question, but here goes.
> SQL2000 SP4
> I have a E: drive on my SQL server that is ~400gb. On it you'll find
> a ~100gb live DB file and last night's 100gb .bak file (maintenance
> plan is set for one day retention). The vendor is telling me that I
> am going to run out of space doing the SQL backups because 100gb is
> used by the live DB, 100gb is used by last nights .bak file, 100gb
> will be used to write today's .bak file, and the last 100gb will be
> used in the deletion process of removing the old .bak file.
> I can't say I know how SQL handles the removal of the old .bak file
> but is this a true statement that SQL will need equal free space to
> delete the old .bak file?|||Right, I aggree. In your scenario I need 300gb, not 400gb as the
vendor claims.
100gb - live DB
100gb - last nights backup
100gb - to create tonights backup
--
300gb Total to perform the whole operation
Vendor is saying:
100gb - live DB
100gb - last nights backup
100gb - to create tonights backup
100gb - extra needed to delete last nights backup after a successful
backup
--
400gb Total to perform the whole operation
I just don't understand why that extra 100gb is needed.
On Nov 28, 10:46 am, "Geoff N. Hiten" <SQLCrafts...@.gmail.com> wrote:
> SQL deletes old backups AFTER creating new ones, so you will need space for
> at least two backups.
> Look at it this way, what happens if your database blows up during a backup.
> If you have an older backup, you are fine. If you are overwriting your only
> backup, it is time to polish up the resume.|||Also, a backup on the same disk as the primary is pretty useless when you
think about it.
--
Geoff N. Hiten
Senior SQL Infrastructure Consultant
Microsoft SQL Server MVP
<rockemhard@.gmail.com> wrote in message
news:b1987afa-2fde-4bcc-9e25-4d2632f7c009@.j44g2000hsj.googlegroups.com...
> Right, I aggree. In your scenario I need 300gb, not 400gb as the
> vendor claims.
> 100gb - live DB
> 100gb - last nights backup
> 100gb - to create tonights backup
> --
> 300gb Total to perform the whole operation
>
> Vendor is saying:
> 100gb - live DB
> 100gb - last nights backup
> 100gb - to create tonights backup
> 100gb - extra needed to delete last nights backup after a successful
> backup
> --
> 400gb Total to perform the whole operation
> I just don't understand why that extra 100gb is needed.
> On Nov 28, 10:46 am, "Geoff N. Hiten" <SQLCrafts...@.gmail.com> wrote:
>> SQL deletes old backups AFTER creating new ones, so you will need space
>> for
>> at least two backups.
>> Look at it this way, what happens if your database blows up during a
>> backup.
>> If you have an older backup, you are fine. If you are overwriting your
>> only
>> backup, it is time to polish up the resume.|||Only if it's not getting written to tape ;)
On Nov 28, 11:28 am, "Geoff N. Hiten" <SQLCrafts...@.gmail.com> wrote:
> Also, a backup on the same disk as the primary is pretty useless when you
> think about it.|||I've never seen Windows needing temp storage in order to delete a file. Perhaps your vendor somehow
confuses the windows Recycle Bin functionality somehow...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<rockemhard@.gmail.com> wrote in message
news:b1987afa-2fde-4bcc-9e25-4d2632f7c009@.j44g2000hsj.googlegroups.com...
> Right, I aggree. In your scenario I need 300gb, not 400gb as the
> vendor claims.
> 100gb - live DB
> 100gb - last nights backup
> 100gb - to create tonights backup
> --
> 300gb Total to perform the whole operation
>
> Vendor is saying:
> 100gb - live DB
> 100gb - last nights backup
> 100gb - to create tonights backup
> 100gb - extra needed to delete last nights backup after a successful
> backup
> --
> 400gb Total to perform the whole operation
> I just don't understand why that extra 100gb is needed.
> On Nov 28, 10:46 am, "Geoff N. Hiten" <SQLCrafts...@.gmail.com> wrote:
>> SQL deletes old backups AFTER creating new ones, so you will need space for
>> at least two backups.
>> Look at it this way, what happens if your database blows up during a backup.
>> If you have an older backup, you are fine. If you are overwriting your only
>> backup, it is time to polish up the resume.sql

equal between a String and a Table atribute?

Ihave a if statement and a table with 2 atributes. They are descriptionand date. I will check if there is in the table some date like01-01-2008.

String test "01-01-2008";

if (test.Equals(here I will a SELECT query like SELECT date FROM appointmentTable))
{

textbox1.text = "The description on this date is: " + Here I will the descripton of the selected date

}

Does someone know how I can make something like this in C#? Must I use a datasource?

Hi,

Because of the nature of Datetime type i think you should not use string values to compare date values. The seperator character may differ or the time (hour,minute etc. ) part may differ...

Try one of these.

First way;

datetime test=new datetime("2008","1","1");

datetime dbValue=convert.ToDateTime(convert.ToDateTime(..get the value from database..).ToShortDateString()) ;

if (test.Equals(dbValue))

{

textbox1.text = "The description on this date is: " + Here I will the descripton of the selected date

}

here we get rid of the hour minute part that is different than 0: convert.ToDateTime(convert.ToDateTime(..get the value from database..).ToShortDateString())

Second way;

?n this way we use ToShortDateString() function of datetime type to make the hour minute part as zeros 0.

datetime test=new datetime("2008","1","1");

datetime dbValue=convert.ToDateTime(..get the value from database..).ToShortDateString() ;

if (test.ToShortDateString().Equals(dbValue.ToShortDateString()))

{

textbox1.text = "The description on this date is: " + Here I will the descripton of the selected date

}

|||

khalidelmeknesi:

Does someone know how I can make something like this in C#? Must I use a datasource?

Well, you will need to make a connection to the data base, to retrieve the results from your SQL statement, and then read the results.

This can be done using any of the datasource objects or manually by

1, creating a sqlconnection, (the connection to your database) sqlcommand (the SQL statement or stored procedure), and sqldataadapter (the mechanism that will save the results to a dataset)

2. fill the sqldatadapter into a dataset (dataset will hold your return results from the database in DataTables and DataRows)

3. check the values returned by iterating through the DataRow in the DataTable of the DataSet

Epoch Date

Help!!! I have an application I support that the vendor is not being
cooperative sin giving me data purge routines. The application uses Epoch
dates (# of ms since 1/1/1970). I found this script on Oracle but need help
converting it to T-SQL where it works without the arithmetic overflow error:
SELECT to_char(
TO_DATE('01-JAN-1970','DD-MON-YYYY') + &epoch_num/86400
,'dd-mon-yyyy hh24:mi:ss') normal_date
FROM dual;Try,
select dateadd(day, epoch_num / 86400, cast('19700101' as datetime))
AMB
"Cathy Soloway" wrote:

> Help!!! I have an application I support that the vendor is not being
> cooperative sin giving me data purge routines. The application uses Epoch
> dates (# of ms since 1/1/1970). I found this script on Oracle but need he
lp
> converting it to T-SQL where it works without the arithmetic overflow erro
r:
> SELECT to_char(
> TO_DATE('01-JAN-1970','DD-MON-YYYY') + &epoch_num/86400
> ,'dd-mon-yyyy hh24:mi:ss') normal_date
> FROM dual;
>|||Hi
here is the solution:
select DATEADD (ms,epoch_num,'01-JAN-1970') normal_date
from <TABLE>
alternatively just go through DATEDIFF and DATEADD functions available in BO
L
thanks and regards
Chandra
"Cathy Soloway" wrote:

> Help!!! I have an application I support that the vendor is not being
> cooperative sin giving me data purge routines. The application uses Epoch
> dates (# of ms since 1/1/1970). I found this script on Oracle but need he
lp
> converting it to T-SQL where it works without the arithmetic overflow erro
r:
> SELECT to_char(
> TO_DATE('01-JAN-1970','DD-MON-YYYY') + &epoch_num/86400
> ,'dd-mon-yyyy hh24:mi:ss') normal_date
> FROM dual;
>|||How do I get around the arithmetic overflow this statement gives me?
"Chandra" wrote:
> Hi
> here is the solution:
> select DATEADD (ms,epoch_num,'01-JAN-1970') normal_date
> from <TABLE>
>
> alternatively just go through DATEDIFF and DATEADD functions available in
BOL
> thanks and regards
> Chandra
>
> "Cathy Soloway" wrote:
>|||Hi
Please go through the following post. This might help you
http://msdn.microsoft.com/library/d...br />
2f3o.asp
thanks and regards
Chandra
"Cathy Soloway" wrote:
> How do I get around the arithmetic overflow this statement gives me?
> "Chandra" wrote:
>|||Are you sure it is milliseconds?
If you see the formaula (epoch_num / 86400), 86400 is the number of seconds
in a day, so the formaula seems to be calculating days. Try second instead
milli:
select DATEADD (second, epoch_num, '01-JAN-1970') normal_date
from <TABLE>
AMB
"Cathy Soloway" wrote:
> How do I get around the arithmetic overflow this statement gives me?
> "Chandra" wrote:
>|||Cathy,
Here's one way. If your epoch_num value is a decimal type,
you'll need to convert it to bigint, so you can use the modulo function.
declare @.epoch_num bigint
set @.epoch_num = 1092347839827
select @.epoch_num/86400000 + DATEADD (ms,@.epoch_num%86400000,'19700101')
Steve Kass
Drew University
Cathy Soloway wrote:
>How do I get around the arithmetic overflow this statement gives me?
>"Chandra" wrote:
>
>|||Thanks Steve. This does it.
"Steve Kass" wrote:

> Cathy,
> Here's one way. If your epoch_num value is a decimal type,
> you'll need to convert it to bigint, so you can use the modulo function.
> declare @.epoch_num bigint
> set @.epoch_num = 1092347839827
> select @.epoch_num/86400000 + DATEADD (ms,@.epoch_num%86400000,'19700101')
> Steve Kass
> Drew University
> Cathy Soloway wrote:
>
>

EOF with SqlDataSource

I am trying to get record from a table and verify it with a textbox i have a sqldatasource.

i have a text box called txtEmail and this is my Select command. how can i get this working if its possible ?

something like txtEmail.text = SqlDataSource1.Secect then ... my code. (i dont know if this a correct way to do this)

<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:imacstestConnectionString %>"

SelectCommand="SELECTEmail FROM [t_CustomerAcct]"

thanks,

Hi,

I'm not quite clear what you want. Do you mean querying with some conditions for a return from the data table and verify if it's equal with the value from the text box or just want to make a query according the value from the text box?

If it's the first scenario, see the following sample:

 <asp:SqlDataSource ID="SqlDataSource1" runat="server" DataSourceMode="DataSet" ConnectionString="<%$ ConnectionStrings:TestConnectionString2%>" ></asp:SqlDataSource>  
SqlDataSource1.SelectCommand ="select CategoryName from Categories where CategoryID='1'";DataView dw = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);string str = dw.Table.Rows[0][0].ToString();if (str ==this.TextBox1.Text) {// equal}else {// not equal}

If it's the second scenario, just make select statement according the value from textbox directly.

this.SqlDataSource1.SelectCommand ="select CategoryName from Categories where CategoryID=@.id";this.SqlDataSource1.SelectParameters.Add("id",this.TextBox1.Text); DataView dw = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);string str = dw.Table.Rows[0][0].ToString();

Thanks.

EOF transactional replication

Hi. I am going out of my mind trying to get transactional
replication working.
Currently the snapshot completes successfully, but I keep
receiving the following error when the initial snapshot
is being applied:
String data, right truncation
(Source: SERVER01 (ODBC); Error number: 22001)
---
String data, right truncation
(Source: ODBC SQL Server Driver(ODBC); Error number:
22001)
---
Unexpected EOF encountered in BCP data-file
(Source: ODBC SQL Server Driver (ODBC); Error number:
S1000)
I have added columns to both the source and destination
to make sure that are sequenced and match perfectly (data
types and null values - everything I can think of)
Using SEM I have been able to use the DTS Export/Import
Wizard to Import into the destination table without any
problems.
Does anybody know what could be causing this error and
how I can fix it.
Also I would really like to see the bcp out snaphot file
to view the contents. How can this been done? Do I need
to add any parameters to the bcp file?
I am at a complete loss... does anyone know how to fix
this, or what could possibly be causing the problem?
Thanks,
Marcy| Hi. I am going out of my mind trying to get transactional
| replication working.
|
| Currently the snapshot completes successfully, but I keep
| receiving the following error when the initial snapshot
| is being applied:
|
| String data, right truncation
| (Source: SERVER01 (ODBC); Error number: 22001)
| ---
| String data, right truncation
| (Source: ODBC SQL Server Driver(ODBC); Error number:
| 22001)
| ---
| Unexpected EOF encountered in BCP data-file
| (Source: ODBC SQL Server Driver (ODBC); Error number:
| S1000)
--
What level of MDAC are you on? Update to the latest MDAC version and see
how you go.
Hope this helps,
--
Eric Cárdenas
SQL Server support|||Right now both servers are on:
Windows 2000
SQL Server Standard Edition
SP3 MDAC Version 2.71.9030.9
You sure this could be the problem?
If so, why?
Thanks,
Marcy
>--Original Message--
>| Hi. I am going out of my mind trying to get transactional >| replication working.
>| >| Currently the snapshot completes successfully, but I keep >| receiving the following error when the initial snapshot >| is being applied:
>| >| String data, right truncation
>| (Source: SERVER01 (ODBC); Error number: 22001)
>| ---
>| String data, right truncation
>| (Source: ODBC SQL Server Driver(ODBC); Error number: >| 22001)
>| ---
>| Unexpected EOF encountered in BCP data-file
>| (Source: ODBC SQL Server Driver (ODBC); Error number: >| S1000)
>--
>What level of MDAC are you on? Update to the latest MDAC version and see >how you go.
>Hope this helps,
>--
>Eric C=E1rdenas
>SQL Server support
>.
>|||| Right now both servers are on:
| Windows 2000
| SQL Server Standard Edition
| SP3
| MDAC Version 2.71.9030.9
| You sure this could be the problem?
| If so, why?
| Thanks,
| Marcy
--
Hi Marcy,
As a full time support professional, my job is to make sure that we've
covered all possibilities. I have seen mismatched or outdated MDAC files
causing this error so I pass this info to you.
There is definitely something that's corrupting your data when you do a
synch. Synch is just bcp out and bcp in behind the covers. Do you
experience the same prob when you do the bcp operations manually?
Hope this helps,
--
Eric Cárdenas
SQL Server support|||Might be a stoopid question, but...
Am I suppose to bcp out to a .txt file and then bcp in the .txt file into the table. Or is there a smarter way for me to test the bcp option manually?
Thanks!
Marcy
>--Original Message--
>| Right now both servers are on:
>| Windows 2000
>| SQL Server Standard Edition
>| SP3 >| MDAC Version 2.71.9030.9
>| You sure this could be the problem?
>| If so, why?
>| Thanks,
>| Marcy
>--
>Hi Marcy,
>As a full time support professional, my job is to make sure that we've >covered all possibilities. I have seen mismatched or outdated MDAC files >causing this error so I pass this info to you.
>There is definitely something that's corrupting your data when you do a >synch. Synch is just bcp out and bcp in behind the covers. Do you >experience the same prob when you do the bcp operations manually?
>Hope this helps,
>--
>Eric C=E1rdenas
>SQL Server support
>.
>

EOF Issue

I am trying to write data to a recordset and it doesn't write to the last record. Here is my code:

Set rs = New ADODB.Recordset
rs.Open sql, conn, 1, 2
With rs
j = 0
Do While Not rs.EOF
rs(0).Value = j
j = j + 1
.Update
.MoveNext
Loop
End With
Set rs = Nothing

I think the problem is my eof setting but I don't know how to adjust that in code since I am not using an adodc. If that is my problem then can I get the code snippet, please?

Otherwise, what is my problem?

Thanks!Have you referred to any VB forums, as I can see most of the SQL database related questions. Try it and see.sql

EOF (end of file)

Hi! Is there an equivalent EOF function in Crystal Reports 8.5.?
I want to use a Do While Loop, but dont know the number of records so
I want to use the EOF so it will terminate upon reaching the end of the
file.
Thanks.you can have RECORD COUNT so based on that number you can specify total number of loops you will require in report