diff --git a/lib/db.php b/lib/db.php
index 02eac7cac9a035297b56ff6c55b8bb9833a9e70d..9fab51edfcd5420c7f860ec4aeecb46e97c8dec0 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -316,8 +316,8 @@ class OC_DB {
 		// read file
 		$content = file_get_contents( $file );
 		
-		// Make changes and save them to a temporary file
-		$file2 = tempnam( get_temp_dir(), 'oc_db_scheme_' );
+		// Make changes and save them to an in-memory file
+		$file2 = 'static://db_scheme';
 		if($file2 == ''){
 			die('could not create tempfile in get_temp_dir() - aborting');
 		}
@@ -331,7 +331,7 @@ class OC_DB {
 		// Try to create tables
 		$definition = self::$schema->parseDatabaseDefinitionFile( $file2 );
 		
-		// Delete our temporary file
+		//clean up memory
 		unlink( $file2 );
 
 		// Die in case something went wrong
@@ -371,8 +371,8 @@ class OC_DB {
 			return false;
 		}
 
-		// Make changes and save them to a temporary file
-		$file2 = tempnam( get_temp_dir(), 'oc_db_scheme_' );
+		// Make changes and save them to an in-memory file
+		$file2 = 'static://db_scheme';
 		$content = str_replace( '*dbname*', $previousSchema['name'], $content );
 		$content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content );
 		if( $CONFIG_DBTYPE == 'pgsql' ){ //mysql support it too but sqlite doesn't
@@ -381,7 +381,7 @@ class OC_DB {
 		file_put_contents( $file2, $content );
 		$op = self::$schema->updateDatabase($file2, $previousSchema, array(), false);
 		
-		// Delete our temporary file
+		//clean up memory
 		unlink( $file2 );
 		
 		if (PEAR::isError($op)) {