SQL Server 2012 :: Write A Process To Get File Size In Kb And Record Count In A File?

Jul 31, 2014

I need to write a process to get file size in kb and record count in a file. I was planning on writing a c# console app that takes the file path and name as a param however should i use a CLR?

I cant put a script in the ssis when it's bringing the file down because it has been deemed that we only use ssis for file consumption.

View 1 Replies


ADVERTISEMENT

SQL 2012 :: Find Out Number Of Columns In Flat File Before Process That Particular File

Apr 14, 2014

I need find out the number of columns in flat file before i process that particular file.I have file name in @filename variable and file path is @filepath variable.But do not not that how i will check the column name in before i will process that file.

@filePath = C:DatabaseSourceFilesCAHCVSSourceFiles
And i am using for each loop container to read the file one by one and put the file name in @filename variable.and my file name like

Product_20120607060930.txt
Product_20130708060930.txt

[code]....

Now what i have to do is i need to make sure that ID,Name,City,County,Phone is there in flat file.if it is not there then i have to send mail to client saying that file is not valid.I need to also calculate the size of flat file.

View 4 Replies View Related

SQL 2012 :: Max Size Of File Which Store To DB By File Stream

Dec 5, 2014

is there limitation for size of file to store in db by filestream in sql server 2008?or it accept all sizes?

View 1 Replies View Related

Backup Master Key, Cannot Write Into File 'c: Empmaster'. Verify That You Have Write Permissions, That The File Path Is Valid.

Jul 12, 2006

Hi,



I tried to backup the master key by the following syntax :

OPEN MASTER KEY DECRYPTION BY PASSWORD = 'mypassword'

BACKUP MASTER KEY TO FILE = 'c: empmaster' ENCRYPTION BY PASSWORD = 'mypassword'

but it failed and i got the following message:

Cannot write into file 'c: empmaster'. Verify that you have write permissions, that the file path is valid, and that the file does not already exist.

NB: I am using the "sa" user to execute this command.

I know that we have a security permission issue , but where and how ?



Regards,

Tarek Ghazali

SQL Server MVP

View 12 Replies View Related

SQL 2012 :: How To Estimate Log File Size

Sep 16, 2014

I was having interesting discussion on estimation of log file with a fellow collegue who happens to be quite knowledgable as well.

He told me if we identify the most frequently hit tables for a database and then (sum their sizes * 1.5) for OLAP we get rough estimate for disk space to be allocated for log file.

View 1 Replies View Related

SQL 2012 :: Too Large Log File Size

Feb 11, 2015

My log file size is of 5 GB, I just wanna reduce this to some extent without adopting shrinking method. So is there any way to do the same ?

View 1 Replies View Related

SQL 2012 :: Calling Remote Batch File Using (Execute Process Task)

Jan 7, 2015

I have a remote batch file on machine B that I need to execute using 'Execute process task' control from a package on machine A.

How Can I achieve this....

View 2 Replies View Related

SQL 2012 :: Database Size From Backup File

Apr 21, 2014

finding the database size from the backup file.I have SQL 2012 backup file, is there any way to find the estimated database size from the backup.I tried restoring , i got an error saying " no space need additional xxx bytes " ...does this error gives the exact space needed to restore ?

One more question....one of the backup file size is 7.2 GB, when i try to restore it ....it throws error saying it needs 292GB extra space while only 100 Gb is available. How come 392 Gb sized database becomes 7.2 Gb .bak file ?

View 5 Replies View Related

SQL 2012 :: MDF File Size Is Growing Fast?

Jul 28, 2014

I have a Problem like the Following ..

On 24th my Mdf size was 10GB,when i checked now the Mdf size was increased suddenly to 30GB.

solution to decrease the Size and as well as where can i check the reasons behind that..

View 2 Replies View Related

SQL 2012 :: Existing Replica MDF File Size Increased In Size Than New Replica Install

Apr 14, 2015

Here are my scenarios:

We have an application with replicated environment setup on sql server 2012 . Users will have a replica on their machines and they will replicate to the master database. It has 3 subscriptions subscribed to the publications on the master db.

1) We set up a replica(which uses sql server 2012) on a machine with no sql server on it. After the initial synchronization(used replmerge tool) the mdf file has grown to 33gigs and ldf has grown to 41 gigs. I went to sql server management studion . Right click and checked the properties of the local database. over all size is around 84 gb with little empty free space available.

2) We set up a replica(which uses sql server 2012) on a machine with sql server 2008 on it. After the initial synchronization(used replmerge tool) the mdf file has grown to 49 gigs and ldf has grown to 41 gigs. I went to sql server management studio , Right click and checked the properties of the local database. over all size is around 90 gb with 16 gb free space available.

3) We set up a replica(which uses sql server 2012) on a machine with sql server 2012 on it. We have dropped the local database and recreated the local db and did the initial synchronization using replmerge tool. The mdf file has grown to 49 gigs and ldf has grown to 41 gigs. I went to sql server management studio , Right click and checked the properties of the local database. over all size is around 90 gb with 16 gb free space available.

Why it is allocating the space differently? This is effecting our initial replica set up times.

View 0 Replies View Related

ASP.net, Database File, Process Cannot Access The File Because It Is Being Used By Another Process

Mar 19, 2008

Hi I am using VWD 2008, SQL Express 2005, Reporting Services, Win-XP, IIS5Basically let's say I have 2 pages:Page1: has a SQLDataSource control that populates a GridView from a table from a database file myDB.mdf  (no code behind)Page2: has a reportviewer control that show a report with data from the same table from myDB.mdf from the reportserver, (no code behind)I have attached myDB.mdf to the SQL Server Express using the SQL Server Management Studio Express.If I first open Page2 to display the ReportViewer it works ok. or using the Report ManagerNow this is the problem:If after that I try to open Page1 then a get an error message:Cannot open user default database. Login failed.Login failed for user 'myServerASPNET'. Exception Details: System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.Login failed for user 'myServerASPNET'.Then I have to restart the SQL Server to fix it,Now I can open Page1 ok, but if after this I try to open Page2 (ReportViewer) againThen I get this error:"      An error has occurred during report processing. o      Cannot create a connection to data source 'my_Datasource'.  &And this error if open the report using the report manager:"      An error has occurred during report processing. o      Cannot create a connection to data source 'my_Datasource'. §      Unable to open the physical file "C:InetpubwwwrootWebsiteApp_DatamyDB.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".  &Now if i check the Management Studio Express again, you can see that myDB.mdf was detached. It seems to be there by it has no Tables or definitions, so I have to attach it again..Do you know how to fix this?Thanks in advance,Ed

View 5 Replies View Related

SQL 2012 :: Increase File Size For A Mirrored Database?

Apr 14, 2015

I need to increase the file size for a mirrored database. I am new to using mirroring for replication. Will increasing the file size break the mirror?

View 2 Replies View Related

SQL 2012 :: Estimate Size Of Data-file While Creating Database?

Mar 24, 2015

How to estimate the size of datafile while creating the database?

View 2 Replies View Related

SQL Server 2012 :: Record Count Of Column Field

Oct 30, 2014

I have created table in which there are four columns (id, date, parcelname, parcelnumber) and 10 rows. I want to count record of the column parcelnumber but condition that, in between two different dates the record should be counted.

View 9 Replies View Related

Is It Possible To Write A Format File That Skips A Few Bytes Of Header In Data File?

Jul 23, 2005

Hi,I am trying to use BULK INSERT with format file. All of our data hasfew bytes of header in the data file which I would like to skip beforedoing BULK INSERT.Is it possible to write format file to skip these few bytes ofheader before doing BULK INSERT? For example, I have a 1 GB data filewith 1000 byte header. Except for first 1000 bytes, rest of the data isgood for BULK INSERT.Thanks in advance. Sorry if it is really a dumb question as I am newto BULK INSERT and practicing still.Bob

View 7 Replies View Related

Log Backup File Size Not Matching Log File Size

Apr 15, 2008

I have a log file that is approximately 50 GIG. I backed up just the log and the file size of the .bak is 192 GIG . Why is this? Shouldn't it be closer to the 50 GIG.

Normally I wouldn't let log grow this much. But we are in process of getting new server up and running and don't have backups going yet. They are working on getting that up and running this week.

So I did a log backup to give me back some log space for now but was concerned when I saw the size of the .bak file.

When I view media contents of the backup device it shows one tranaction log back up and size of 192 GIG.

What is up with this. I know in SQL 2000 the log backup files where never this big. they were about the size of the log itself.

Any ideas?

Stacy

View 8 Replies View Related

Unable To Open The Physical Mdf File Or Log File Because It Is Being Used By Another Process

Dec 4, 2007


Unable to open the physical mdf file or log file because it is being used by another process

I am trying to write a Windows Application using ASP.NET 2.0, C#2005 EXPRESS, and SQL 2005 EXPRESS.

I had followed the introductory video to create a connection to the Database using Windows Authentication, and use the wizard to create a dataset and checking all the tables in the database.

After that I dragged a table from the data source created from the above process. The Details Grid so created is able to perform update, delete and addition of records.

But when I went back to the database at my PC I wasn€™t able to connect to the database. And if I opened the database first and then load the windows application and perform some database operations and went back to the physical database I wasn€™t able to open the tables in the database.

The error message is that the physical database connection cannot open the .mdf file or log file because another process is using the database. I guess it refers to the Windows Application.

Is this normal? Will it have any implications after the application is deployed? I suppose that there isn€™t a scenario where a Windows application and a physical process will access the database at the same time.

Will appreciate some feedback and advice on this scenario and whether it is a problem.

Thanks and regards

OldStd

View 7 Replies View Related

Check File For Being Used By Some Other Process When Using Flat File Source

Feb 14, 2007

I am wondering how easy is to check for file locks and have our SSIS Package to wait until file has been release by the process which is using it.

Also, same question when we're writing to a Flat File (or Flat File Destination).



Thanks,

View 3 Replies View Related

SQL 2005 Resize Initial Log Size: MODIFY FILE Failed. Specified Size Is Less Than Current Size.

Sep 4, 2007


I am trying to resize a database initial log file from 500M to 2M. I€™m using€?

ALTER DATABASE <DBNAME> MODIFY FILE ( NAME = <DBLOGFILENAME, SIZE = 2 ) "



And I'm getting "MODIFY FILE failed. Specified size is less than current size." I tried going into the database properties and setting the log file to 2M, but it doesn€™t keep the changes.



Any help with this process?

View 1 Replies View Related

Using The File Connection Manager To Write To A File

Jan 7, 2008

Is there any real purpose to the File Connection Manager? Not the Flat File Connection Manager, just the plain old File Connection Manager.

I have one in my SSIS package because I thought it might make writing to a file easier. But from what I can tell, it doesn't really do much. I have to pull the file name from the connection manager and basically open and manage the file myself in my scripts.

I went this route because I have two scripts that write to the file in turn... one writing out parent records and the other inserting the child records after each parent.

The script looks like this:




Code Block
Dim outFile As String
outFile = Dts.Connections("TestFile.LDIF").AcquireConnection(Dts.Transaction).ToString()

Dim sw As New StreamWriter(outFile, True)
sw.WriteLine()
sw.WriteLine("dn: " & Dts.Variables("GroupID").Value.ToString())
sw.WriteLine("changeType: add")

sw.Close()

I have to close the connection every time because the other script uses the file. It seems that this is quite inefficient. Am I using the File Connection Manager incorrectly? What's a more appropriate way to do this?

I could open the file in a different script and store the StreamWriter object in a global variable, I suppose...

Thoughts, suggestions?

Thanks.

J


View 9 Replies View Related

DB Engine :: Recommended Size And File Growth For A Database And Log File?

Sep 22, 2015

What is the recommended size and file growth for a database and log file? We will be storing approx 10000 records a day.Currently we have the following:

CREATE DATABASE Dummy
ON 
PRIMARY
( NAME = Dummy_data,
    FILENAME = 'D:....DATADummy.mdf',
    SIZE = 250MB,
    FILEGROWTH = 25MB )
LOG ON
( NAME = Dummy_log,
    FILENAME = 'D:....DATADummy_log.ldf',
    SIZE = 50MB,
    FILEGROWTH = 5MB ) ;
GO

View 3 Replies View Related

Write File To DB From Server

Aug 27, 2006

Hi, How can I read a file on the server and insert it into my SQL Server database.  The user is not uploading the file, but it already exists on the Server. Thanks

View 1 Replies View Related

Log File Size (IDF) Is 4 Time Greater Than Data File (MDF)

Feb 19, 2013

I have a database whose log file size is 4 time greater then data file size, and its continuously growing day by day. Recently face limited disk related issue.

Is there any way to truncate log file???

What is impact on db if i truncate log file???

Is there any way to prevent this file continuously growing???

View 13 Replies View Related

FCB::Open: Operating System Error 32(The Process Cannot Access The File Because It Is Being Used By Another Process.) Occurred W

Dec 3, 2007

Hello all,
I am running into an interesting scenario on my desktop. I'm running developer edition on Windows XP Professional (9.00.3042.00 SP2 Developer Edition). OS is autopatched via corporate policy and I saw some patches go in last week. This machine is also a hand-me-down so I don't have a clean install of the databases on the machine but I am local admin.

So, starting last week after a forced remote reboot (also a policy) I noticed a few of the databases didn't start back up. I chalked it up to the hard shutdown and went along my merry way. Friday however I know I shut my machine down nicely and this morning when I booted up, I was in the same state I was last Wenesday. 7 of the 18 databases on my machine came up with

FCB:pen: Operating system error 32(The process cannot access the file because it is being used by another process.) occurred while creating or opening file 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataTest.mdf'. Diagnose and correct the operating system error, and retry the operation.
and it also logs
FCB:pen failed: Could not open file C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataTest.mdf for file number 1. OS error: 32(The process cannot access the file because it is being used by another process.).

I've caught references to the auto close feature being a possible culprit, no dice as the databases in question are set to False. Recovery mode varies on the databases from Simple to Full. If I cycle the SQL Server service, whatever transient issue it was having with those files is gone.
As much as I'd love to disable the virus scanner, network security would not be amused. The data and log files appear to have the same permissions as unaffected database files. Nothing's set to read only or archive as I've caught on other forums as possible gremlins. I have sufficient disk space and the databases are set for unrestricted growth.

Any thoughts on what I could look at? If it was everything coming up in RECOVERY_PENDING it's make more sense to me than a hit or miss type of thing I'm experiencing now.

View 13 Replies View Related

Check Db Size Data File And Log File

Apr 27, 2008

Hi,

i'm trying to write this script that check my database file and log size(in MB) and insert them into a table.i need the following columns
dbid,dbname,compatability_level,recovery_model,db_size_in_MB,log_size_in_MB.
i try to write this a got stuck.
select sysdb.database_id,sysdb.name,sysdb.compatibility_level,
sysdb.recovery_model_desc,sysmaster.size from sys.databases sysdb,sys.master_files sysmaster
where sysdb.database_id = sysmaster.database_id

can anyone help me with this script?
THX

View 13 Replies View Related

Restoring BAK File Increases Log File Size

Sep 5, 2007



We have 2 SQL Server 2k5 servers running the same build - 9.0.2047 . When I backup any database from one server and attempt to restore it to the other, the log file generally increases by 100 fold. It errors out after I try to restore a 100MB db and it tries to create a 9.8GB log file. This happens both when I use the GUI to restore and when I restore from a T-SQL script. What am I doing wrong?

Thanks in advance.

View 1 Replies View Related

SQL Server 2008 :: Can't Access File Because It Is Being Used By Another Process

Feb 4, 2015

I am working with SSIS package. It executes everyday.

It has the file system task. It moves the production backup from one server to the different server. In today's execution the package failed with the following error

Error Description:An error occurred with the following error message: "The process cannot access the file 'ECOSQLDumpsTest_backup_2015_02_03_230004_1557700.bak' because it is being used by another process.".

How to find which process is using that test backup file?

View 2 Replies View Related

SQL 2012 :: Check Columns Before Process And Calculate Size In Byte In SSIS

Apr 10, 2014

I need find out the number of columns in flat file before i process that particular file.

I have file name in @filename variable and file path is @filepath variable.

But do not not that how i will check the column name in before i will process that file.

@filePath = C:DatabaseSourceFilesCAHCVSSourceFiles

And I am using for each loop container to read the file one by one and put the file name in @filename variable.

and my file name like

Product_20120607060930.txt
Product_20130708060930.txt

My file structure is:

ID,Name,City,Country,Phone
1,Riya,Pune,India,454564
2,Jiya,New Jersey,India,454564
3,Riya,St Louis,USA,454564
4,Riya,Belleville,USA,454564
5,Riya,Miami,USA,454564

Now what i have to do is i need to make sure that ID,Name,City,County,Phone is there in flat file. if it is not there then i have to send mail to client saying that file is not valid.

Let me know how i will do it.I need to also calculate the size of flat file.

View 0 Replies View Related

Write Data From A SQL Server Table Into An Excel File

Apr 30, 2007

Hi,



I need to export data from a table of SQL server 2000 database, into an Excel 2000 sheet. I tried following query from the sql query analyzer




Code SnippetSELECT * INTO [Excel 4.0;Database=F:ew.xls].[sheet1] FROM tab1





It gave me following error




Code SnippetServer: Msg 2760, Level 16, State 1, Line 1
Specified owner name 'Excel 4.0;Database=F:ew.xls' either does not exist or you do not have permission to use it.




The F:ew.xls file is present and it has no additional security applied, hence I think it should be writable.



Please tell me where am I doing wrong.

I don't know if this is the correct news group or not. Let me know if I have to post to some other news group.


- Abhijit

View 3 Replies View Related

ASPNETDB.MDF: The Process Cannot Access The File Because It Is Being Used By Another Process

Feb 17, 2007

Hi,
I'm trying to upload the ASPNETDB.MDF file to a hosting server via FTP, and everytime when it was uploaded half way(40% or 50%)
I would get an error message saying:
"550 ASPNETDB.MDF: The process cannot access the file because it is being used by another process"
 and then the upload failed.
 I'm using SQL Express. Does anybody know what's the cause?
 Thanks a lot

View 1 Replies View Related

SQL Server 2000 Log File Size

Nov 10, 2006

Am running several databases on SQL server 2000.
Have several overnight jobs for interface and maintenance, etc.
Log file on one specific database increases in size 10 fold overnight. Unable to trace why.
I have a job to truncate the logs before the final overnight backup. Several times a week the job hangs - on nights when log file expands, so it is a pain. Able to resolve the issue after the event, but do not understand why the log file increases in size (at that time) in the first place. No other activity on the server at the time.

View 2 Replies View Related

Sql 2005 Install Error. MODIFY FILE Failed. Specified Size Is Less Than Current Size.

Jun 15, 2006

I installed sql 2005 a while back. Then I recently found out my file system was fat32 (I don't understand why the hardware people did this...) and I had to convert to NTFS. Naturally the sql service no longer worked so I uninstalled inorder to reinstall now I can't reinstall it I keep getting this message



native_error=5039, msg=[Microsoft][SQL Native Client][SQL Server]MODIFY FILE failed. Specified size is less than current size.


I'll try to post the full log in a new post.



View 11 Replies View Related

SQL 2012 :: TempDB Log File Usage Constantly Rising And File Keeps Growing?

Jun 16, 2014

The TEMPDB transaction log file keeps growing.The database server is new and the transaction log was presized to 1 GB on installation. After installing a number of databases, the log file grew over a day to 38GB. Issuing a manual checkpoint was the only way to free some space to allow it to be shrunk back to a usable size. The usage of the file is still going up.

I am struggling to find what process is causing the log to be used so heavily. Looking at the log reuse wait desc for tempdb returns "Nothing" and tempdb itself isn't being used very much or growing in size.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved