How Can I Shrink SQL Express Database On Local Machines?

Oct 27, 2006

Hello,

I have deployed a vb.net application to a few laptops that holds the SQL Express database as a local datastore. What is the best way to compress or shrink the database and log files? I would like a way that this can be done automatically or unattended if possible...

Thanks in advance.

View 10 Replies


ADVERTISEMENT

Accessing SQL CE From Other Local Machines

May 1, 2008

Hi,

I'm in the process of designing a system which will have a central internet based SQL Server database, and one or more clients running SQL CE.

If there is more than one client machine running the same software, is it possible to have all these clients use a central SQL CE db on one of the clients? In other words can other machines access a SQL CE running on say a "master" machine? These machines my be in a workgroup or on a domain by the way.

I know I could use a SQL Express db on the master machine, but I'm keen to use SQL CE because of the Sync services dlls that came with VS 2008 (which I believe only work in CE).

Thanks,
Russ

View 3 Replies View Related

Importexport An SQL Db Between Remote And Local Machines

Mar 11, 2008

Hi Guys!
I'm trying to find a way to either importexport or synchronise an SQL 2005 db between a local and remote server, is there any way to do this programatically or otherwise? doesn't have to be the entire db, (like just aspnet_users and related tables will do)
Thanks for the help all!

View 3 Replies View Related

How Can Users Download Cubes To Their Local Machines?

Apr 8, 2004

Hi,

I read in oneof the articles somewhere that users can also download cubes to their local machines for off-line browsing/analysis. This can be very useful if the user is suppose away from the office or not connected to the LAN.

I wanted to request if someone can explain the process of how users can do this i.e. download/save a copy of the cube to their local machines?

Thanks.

View 4 Replies View Related

Give Access To Local Express Database

May 28, 2015

I've created a local server from Sql Express, and report server from Reporting service configuration manager, and than publish a report on the local report server. I want to give access to the other computer user to the sql reports, database and report server.

View 0 Replies View Related

SQL Server Express And Client App Both On Win XP Machines ?

Mar 29, 2007

Hi,



Can I access from App machine (on WinXP) to SQL 2005 Exp machine (on WinXP) ?



I installed SQL 2005 Exp SP2 on Win XP SP2 on my PC. Please consider following environment:



- My PC name: MyPC

- Database name : MyData

- Database role for MyData without any permissions: MyDBRole

- Application role for MyData having all permisions: MyAppRole

- Database user: MyDBUser

- SQL Login: MyLogin (WinXP Limited Login) mapped to MyDBUser

- Application Name to access MyData: MyApp

- Using Application Role MyRole in MyApp



I am accessing data from MyApp within MyLogin. When I want to access from other tool like Management Studio Express, I can not access it and that that is what I want.



Till now it is OK when I am doing all these things on MyPC.



Now question is : Is it possible to connect from other PC (say CleintPC) running Windows XP SP2 use MyApp ?



I think ClientPC should access MyPC through MyPC's MyLogin.



[ I have tried successful simple SQL server connection with MyPC's Guest Login]



Please tell me is it possible ? (Running SQL Express on one machine, Application on second machine and both machine's operationg system is Windows XP)



Thanks

View 1 Replies View Related

CE DB Requires SQL Express Install On Client Machines?

Aug 27, 2007

I'm working on a C# 2008 project, when i add a CE Database to it, then publish the app, the installer wants to download and install the entire SQL Server Express product on the client machines. My understanding is that I should be able to embed this database right into the app, but it defeats the purpose to have the installer download and install the entire express product (the actual project is 1 meg).

Is this expected behavior? or am I doing something wrong?

View 3 Replies View Related

Detach Database File From Local SQL Server Express Instance By C#?

Jan 30, 2008

I am using the following C# code to establish a SQL connect to a SQL database file:

// connection string
// attach a SQL database file to a local SQL server express instance
string _connectionString = @"Server=.SQLExpress; AttachDbFilename=C:BalanceDatabase_1.mdf; Trusted_Connection=Yes; User Instance=True";

// using System.Data.SqlClient;
SqlConnection _sqlConnection = new SqlConnection(_connectionString);
// open the connection
_sqlConnection.Open();

// do something

// close the connection
_sqlConnection.Close();

So far, the connection works fine.

However, next, I want to copy the database file to another folder. So the following codes:
// source database file name
string sourceDatabaseFileName = @"C:BalanceDatabase_1.mdf";
// target database file name
string targetDatabaseFileName = @"D:BalanceDatabase_1.mdf";
// copy database file
System.IO.File.Copy(sourceDatabaseFileName, targetDatabaseFileName, true);

Then the program came with runtime exception: "IOException was unhandled: The process cannot access the file 'C:BalanceDatabase_1.mdf' because it is being used by another process."


Is it because the database file was sill attached to the local SQL Server express instance? What can I do to bypass this problem? Detach the database file? or dispose the local SQL Server express instance?

Many thanks indeed!

View 9 Replies View Related

Is It Possible To Send Message From SQL Server Express To Applications Using It On Different Machines ?

Mar 8, 2008

Hello,

Is it possible to send message from SQL Server Express to Applications using it on different machines ?

For example When an important record is inserted or updated, a message appears on Application user's screen.

If yes then how ?

Thanks

View 3 Replies View Related

Give IIS Permision To Run SQL Server 2005 Express Database Under Local Host.

Mar 22, 2007

I have an ASP.NET application that runs under the development server.  Before deploying to my host I wanted to test it under IIS.  I set up a virtual directory under IIS, but when I try to open the home page I get an error Unable to open the physical file
"E:CDiskLocalWebSitesDIWSchedulingApp_DataDIWDB.MDF". Operating
system error 5: "5(Access is denied.)".and a code dump showing that the code is breaking at the open connection.  A little research on the error indicates that IIS does not have permission to execute the database operation.  I can not find any information on how to give IIS this permission in SQL Server 2005 Express.  Any guidance would be appreciated. 

View 7 Replies View Related

Problem Connecting To Sql Server 2005 Express Database On Local Computer

Mar 18, 2008

I have a very basic console application whose sole purpose is to query a database on the same local computer. When i run the application, i get the error message below:
Cannot open user default database. Login failed.Login failed for user 'someDomainSomeUserName'.
Below is my connection string also
myconnection_string = New SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=C:Reporting SystemApp_Datasafetydata.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True").
 After some googling, some post pointed to deleting a user folder at :
C:Documents and SettingsmyusernameLocal SettingsApplication DataMicrosoftMicrosoft SQL Server DataSQLEXPRESS
 but still deleting that folder and restarting the machine doesn't help and i also have remote connections enabled. Help is really needed.
 NOTE: The same application runs on a different computer with XP but fails on the Pc with windows server 2003.
 
 

View 3 Replies View Related

Failed To Attach AdventureWorks_Data.mdf Into SQL Server 2005 Express Database In Local

Mar 19, 2008

 After i reinstall SQL Server 2005 Express on my local machine, and then tried to attach AdventureWorks_Data.mdf into Database, it gives me the following error:
Mark up:

I tried to reinstall the Adventureworks.msi installer and reattach again in SQL Server 2005 Express, it gave me the same error.
I then deleted both SQL Server 2005 Express & Adventureworks, and then restart my pc and reinstall again, it still gave me the same error.
Error: 
Failed to retrieve data for this request. (Microsoft.SqlServer.Express.SmoEnum)
Additional Information:
 An Exception occurred while executing a Transact-SQL Statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)
 CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:Program FilesMicrosoft SQL ServerMSSQL.1DataAdventureWorks_Data.mdf' (Microsoft SQL Server, Error:5123)

View 5 Replies View Related

SQL Server 2008 :: Same Database With Two Different Machines At Different Times

Jun 19, 2015

For security reasons customer wants to put a SQL database on an encrypted thumb drive (IronKey). Here's the rub though. He wants to be able to work with the data on a workstation. Then, if he takes his laptop out of the office he wants to be able to simply plug that thumb drive into the laptop and fire up SQL on the laptop and use that same database. Procedurally this would work in that the database can be created so that the location is the same from both machine viewpoints, however will the two different SQL instances allow moving the database back and forth like this?

View 9 Replies View Related

Database Access By Machines Running SQL Servers 2005 32-bit And 64-bit

Oct 11, 2006

Hello

We have 1 machine running SQL Server 2005 x64 (64 bit). The other machine is backing this SQL Server up. It is a 32-bit machine, so it requires (?) a 32-bit version of SQL Server 2005.

Would this back-up machine work correctly on a database previously managed by a 64-bit machine and vice versa.

Thank you!

View 3 Replies View Related

Not Able To Connect To The Local Database With (local) As Server Name

Jun 7, 2006

I am facing a problem in connecting to the local database with server name as (local).

I have installed SQL Server 2005 in my machine. When I try to connect to the SQL server with the server name as SUNILKUMAR I am able to connect but when I try to connect to the same server with the server name as (local) I am not able to connect. SUNILKUMAR is my machine name and SQL server is running locally.

if anyone can help me what is the problem in this case it is highly appriciated.

View 7 Replies View Related

Need Help - Local Synchronization Between SQL Mobile And Local SQL Database

Dec 21, 2005

Hi Everyone

I am at the stage of architecting my solution

My goal is to develop the system on a windows application and pda

There is a central server which will create a publication called inventory

The laptops which host the windows application will be subscribers to the central server using merge replication

The client now wants the PDA using SQL Mobile to synchronize with the local subscirber database on the laptop using active sync. They dont want to do it via WIFI to the IIS Server at the central server

I have been reading for days and I am still unsure whether this is possible to do.

I know Appforge provide a conduit for palm to access synchronization but not local sql databases

I would appreciate your help immensley

View 7 Replies View Related

Is Local Admin Required For C# Express/SQL Express?

Mar 10, 2007

I have been trying to get Visual Studio Express w/C# to work with SQL Express. If I run with my normal local privs set to Debug User, I get a Login Failed message when I try to add a SQL database using the Add Item feature from the Solution Explorer. If I set my account to run as local administrator, everything works as expected. I am unable to connect to anything from the Database Explorer as well unless I am local admin.

I can run the SQL Express management utilities with no trouble when logged in as Debug User, and everything else in Visual Studio seems to work OK as well.

Is there a cure for this? I keep preaching to my users about the dangers of running as local admin, so I would feel uneasy about doing so myself just to be able to use VS Express.

View 9 Replies View Related

Why Is Database Still Big After Shrink?

Jul 26, 2000

A few of the databases I have are take up a lot of space, but when I look at the actual space that's being used, it's very small. I've tried shrinking them but they still remain at this bloated size. Is there any other way to reduce their size?

View 3 Replies View Related

SHRINK Database

Nov 9, 1999

I am in the process of copying database from large size to smaller size one. The actual data in the database is very less.
When I try to shrink the database, I am getting message I can't shrink the database.

Can any one suggest on 'How to copy this database?'

Thank you,

View 4 Replies View Related

Can't Shrink The Database Log...

Jan 21, 2004

Hi
I have a SQL2k db ABC with only 2mb data but around 500 log. I did the followings
----------------------------------
backup log ABC with truncate_only
dbcc shrinkdatabase(ABC, 10)
Cannot shrink log file 2 (ABC_Log) because all logical log files are in use.
DbId FileId CurrentSize MinimumSize UsedPages EstimatedPages
------ ------ ----------- ----------- ----------- --------------
7 2 58768 128 58768 128

use ABC
sp_spaceused
database_name database_size unallocated space
------------ ------------------ ------------------
ABC 506.75 MB -0.51 MB
reserved data index_size unused
------------------ ------------------ ------------------ ------------------
2248 KB 1288 KB 544 KB 416 KB

sp_helpdb ABC
name size maxsize growth usage
-------------- ------------------ ------------------ ------ ---------
ABC_Data 1728 KB Unlimited 10% data only
ABC_Log 517184 KB Unlimited 10% log only

question:
1. what is the negative -0.51 MB for unallocated space?
2. I can't kill all the process logins, is there other way to shrink the database log side?

thanks
-D

View 6 Replies View Related

How To Shrink My Database

Aug 22, 2006

hello

i know how to do shrinking DBCC SHRINKDATABASE( XXX,10).

But my question is how we know minumum shrinking Database value through stroed procedure.

please help me i need to shrink Database.



thanx

kiran

View 4 Replies View Related

Do I Need To Shrink My Database?

Jul 7, 2006

Hello,

I have SQL Server Server Man Studio Express 2005, currently having a problem with an auto populated field.

Basically I have a webpage that when I create a new item it populates a new ID, which is the primary key and read only when I go into the database backend so i cannot manually change this.

When I have been doing some testing adding fields to the table and deleting this has obviously given me new ID's such as 113, 114 etc. But on my live site I need these ID's to be sequential, so on my live site the last ID is 108, but now when I add another item the ID is 115 because the number between this and 108 have been taken up.

So my question is really do I need to shrink my database or files to take this down to 109, if so is database shrink or file the best to do? Also i have had someone add a new live item and this has been assigned 113, would I need to delete this, shrink and then re-enter?

Any suggestions would be greatley appreciated.

Many thanks.

View 6 Replies View Related

Shrink My Database

Aug 17, 2006

Hello anybody Help me?

I am new for working Database side?

MyDatabase name is 'DS'

i need to shrink my Database and files through stored procedure.

How to shirnk my Database.

can anybody help me?

thanx

kiran

View 5 Replies View Related

Database Shrink

Jun 12, 2007

Hi,

Does database shrinking require all requisites that are necessary for compacting (like additional free space and closed database) ?
And is there any programmatic way to estimate optimized database size regarding current database size, like it was done by special tool in SQL Management Studio?

View 1 Replies View Related

Moving A SQL Server 2000 Database From A Local Drive To Another Local Drive

Jan 31, 2008

Being a very novice SQL Server administrator, I need to ask the experts a question.

How do I go about moving a database from 1 drive to another? The source drive (C is local to the server, but the target drive (E is on a Storage Area Network (SAN), although it is still a local drive for the server. I want to move the database from C: to E:. Can someone provide me with instructions?

Thanks,
Rick

View 4 Replies View Related

Database Grow/Shrink

Jan 13, 1999

OK. Here's a good one.

I wrote a query that caused a HUGE amount of stuff to be written to the transaction log. Since I set the database up before I had enough coffee yesterday, I didn't turn on a "Restrict Filegrowth" on the log. So the transaction ran until it filled up the available space on the drive (my local workstation, so it grew to about 6 GB) and then it rolled back. (BTW: Microsoft finally figured out that rolling back a transaction shouldn't be a blocking operation. ISQLW tells you that the transaction failed as soon as it fails, and then releases the connection to you, so you can go on with your life while SQL Server cleans up. Good one!)

OK. So that done, I figured I'd just truncate the transaction log and do the nifty new "DBCC SHRINKFILE()" thing. So I truncate the log and do DBCC SHRINKFILE. Nothing happens. Enterprise Mangler (OOPS Manager. I really mean Manager) shows that only 43 MB of the 6 GB file is in use. DBCC SHRINKFILE reports that the minimum size is 128 pages, the current size is 697,256 pages, and 697,256 pages are used.

Great. So I can't shrink the file.

Step 2: I dump (OOPS, sorry, BACKUP) the database, delete the database, make sure all the files are gone, and then restore the database. It re-creates the 6 GB file, which, by the way takes a very long time. What's funny about that is the query timer in ISQLW reports that the query took 30 minutes, but the return from the restore command shows that it took about 300 and some seconds (about 5 minutes) because the restore command doesn't count the amount of time it took to build the files (I'm guessing). After I figure out that it rebuilt the 6 GB file, I screamed, and started downloading PostGreSQL for my Linux box, and got on to other projects.

This morning I came in and started reading Books Online to figure out what's going on. It says something about "Virtual Log Files" and how a log can't be shrunk past that point. Great. MS basically defines a virtual log file as "the point past which you can't shrink a log". So I have a 5 GB virutal log file, and I can't truncate it, shrink it, or make it go away.

So I have a stroke of genius and decide to build a new log file in the database, and then use the DBCC SHRINKFILE command with the EMPTYFILE option, and then use ALTER DATABASE to remove the file.

Then I get this really cool error that says:
Server: Msg 5020, Level 16, State 1, Line 1
The primary data or log file cannot be removed from a database.

OK. Last time I checked, a log file doesn't belong to a primary filegroup, so there's something else going on here. Basically, it looks like the first file that gets created is the "Primary" file and can never be removed.

So, new policy, every "first" file in a database is going to be a 2 MB file, with a 2 MB growth limit, so we can remove it later. That's a load of....fertilizer.

It looks like the AutoShrink for logs is just a myth. Auto-Grow seems to work almost too well, though. I'm picturing one of those Access newbies using the Export function in Access to put data into SQL Server on one of our pre-production boxes, and having a 180 GB log that can't be shrunk. That'll be a good time.

The moral of the story: Always set growth restrictions, especially on log files.

The questions:
1. Anybody got any bright ideas on how I can get my disk space back WITHOUT using BCP (or DTS, or similar methods)?

2. Anybody know how a different file can be set as a "PRIMARY" file?

3. Anybody know why MS decided to fill the Transact-SQL help in ISQLW with "You can't get there from here" messages that reference Books Online?

Thankfully, this isn't anywhere in our production system, and if the quality continues this way, it won't ever be in our production system.

chris.

View 1 Replies View Related

Shrink Database Command

Mar 13, 2003

What does the shrink command exactly?
I start the shrink command in the Enterprise Manager of SQL7/2000. Does it include re-indexing of all tables?
And is it the same command as auto-shrink can be selected in the db properties?

Thanks for your info

mipo

View 7 Replies View Related

Shrink Database Log Size ......

Jun 28, 2004

I want to shrink database:

1. backup log ABC with truncate_only
2. dbcc shrinkdatabase(ABC, 10)

Cannot shrink log file 2 (ABC_Log) because requested size (113792KB) is larger than the start of the last logical log file.

DbId FileId CurrentSize MinimumSize UsedPages EstimatedPages
------ ------ ----------- ----------- ----------- --------------
7 2 14432 12800 14432 12800

there is no transaction in this ABC database. Is there way to shrink it?
Not quite sure about "because requested size (113792KB) is larger than the start of the last logical log file.". The current log size is 113 mb.
thanks
-D

View 2 Replies View Related

Dbcc Shrink Database

Nov 4, 2004

Morning,

Is there a specific command/clause in the DBCC SHRINKDATABASE command where I can force a database to release free space to the operating system ?

Cheers,

Duncan

View 3 Replies View Related

Issue With Shrink Database.

Apr 19, 2007

When i try to shrink the database, i am getting the following error:
Cannot use the PAGE granularity hint on the table "dbo.salary" because locking at the specified granularity is inhibited.
DBCC SHRINKDATABASE: Heap page 1:422421 could not be moved.
The statement has been terminated.
DBCC execution completed. If DBCC printed error messages, contact your system administrator. (.Net SqlClient Data Provider)

Any help apreciated...

View 2 Replies View Related

How To Shrink SQL Server Database

Jul 4, 2007

First of all thanks for taking interest in this thread.

I have database in Microsoft SQL Server and its size is appx. 427 GB. It consists of data from 2006. Everyday I expire data of 2-3 days and then try to shrink database as much as possible.

But it frees only 2-3 MB after 7-8 hours process. And in that database there some files which do not shrink even I put one of them on shrinking for whole day.

And as per company policy, I am only allowed to expire data which are 15 months older.

I am facing very much problem as my daily import and publish activity some times got failed for that reason.

If anyone knows the solution please tell me the solution.

View 14 Replies View Related

Does Database Need To Shrink After Truncating?

Mar 15, 2007

There is a table need truncate and then insert a huge data (more than million rows) every day. Does database grow up every day?

View 2 Replies View Related

Problem In Doing Shrink Database

Jul 23, 2005

hi all,This will be a easy question for all out here.I have a database of 28GB.having 3 Data Files 22 GB, 3.58 Gb and 2.70 GB respectively.and a Transaction Log file of 156 mb.When i executed DBCC Shrinkdatabase(databasename),it reducedsize of datafile but the LOG file had gone up to 5 Gb from 156mb.I want to know why this happened and how should i shrink Log File orany other option.One more doubt how does Dbcc ShrinkDatabase help in performance.A kick to a right direction will be helpfull to me.Thanks in advancetvpsI also used DBCC SHRINKFILE(database_log)but their was no changein size of log file.

View 4 Replies View Related







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