diff --git a/core/command/db/converttype.php b/core/command/db/converttype.php
index 617910b3a9051825584f09a5dc4d9f907323fc29..92ca9e41ebe512f69dde88ad341bd22491e8b81c 100644
--- a/core/command/db/converttype.php
+++ b/core/command/db/converttype.php
@@ -228,6 +228,8 @@ class ConvertType extends Command {
 	}
 
 	protected function getTables(Connection $db) {
+		$db->getConfiguration()->
+			setFilterSchemaAssetsExpression('/^'.$this->config->getSystemValue('dbtableprefix').'/');
 		return $db->getSchemaManager()->listTableNames();
 	}
 
diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php
index 78267094d0ee9989e5594aeb2b61a552e0f631d9..d90c8525a7bef956de9b37f36c8c860b450105f3 100644
--- a/lib/private/db/mdb2schemamanager.php
+++ b/lib/private/db/mdb2schemamanager.php
@@ -36,9 +36,7 @@ class MDB2SchemaManager {
 	 * TODO: write more documentation
 	 */
 	public function getDbStructure($file, $mode = MDB2_SCHEMA_DUMP_STRUCTURE) {
-		$sm = $this->conn->getSchemaManager();
-
-		return \OC_DB_MDB2SchemaWriter::saveSchemaToFile($file, $sm);
+		return \OC_DB_MDB2SchemaWriter::saveSchemaToFile($file, $this->conn);
 	}
 
 	/**
diff --git a/lib/private/db/mdb2schemawriter.php b/lib/private/db/mdb2schemawriter.php
index a2a62a8147595ec7a4f235b8fb775da77e4743f6..3c91f3c784aeb5235c9c6b7a9d1ca96a089a43a9 100644
--- a/lib/private/db/mdb2schemawriter.php
+++ b/lib/private/db/mdb2schemawriter.php
@@ -13,13 +13,17 @@ class OC_DB_MDB2SchemaWriter {
 	 * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $sm
 	 * @return bool
 	 */
-	static public function saveSchemaToFile($file, $sm) {
+	static public function saveSchemaToFile($file, $conn) {
 		$xml = new SimpleXMLElement('<database/>');
 		$xml->addChild('name', OC_Config::getValue( "dbname", "owncloud" ));
 		$xml->addChild('create', 'true');
 		$xml->addChild('overwrite', 'false');
 		$xml->addChild('charset', 'utf8');
-		foreach ($sm->listTables() as $table) {
+		
+		$conn->getConfiguration()->
+			setFilterSchemaAssetsExpression('/^'.\OCP\Config::getSystemValue('dbtableprefix'.'/'));
+		
+		foreach ($conn->getSchemaManager()->listTables() as $table) {
 			self::saveTable($table, $xml->addChild('table'));
 		}
 		file_put_contents($file, $xml->asXML());
diff --git a/lib/private/db/migrator.php b/lib/private/db/migrator.php
index 31c648a9b65af831aff7656593d08055cff91611..903e9b8a716961a4d5787e4145ec11d05726fab2 100644
--- a/lib/private/db/migrator.php
+++ b/lib/private/db/migrator.php
@@ -69,7 +69,9 @@ class Migrator {
 		 * @var \Doctrine\DBAL\Schema\Table[] $tables
 		 */
 		$tables = $targetSchema->getTables();
-
+		
+		$this->connection->getConfiguration()->
+			setFilterSchemaAssetsExpression('/^'.\OCP\Config::getSystemValue('dbtableprefix').'/');
 		$existingTables = $this->connection->getSchemaManager()->listTableNames();
 
 		foreach ($tables as $table) {
@@ -153,6 +155,8 @@ class Migrator {
 	}
 
 	protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) {
+		$connection->getConfiguration()->
+			setFilterSchemaAssetsExpression('/^'.\OCP\Config::getSystemValue('dbtableprefix').'/');
 		$sourceSchema = $connection->getSchemaManager()->createSchema();
 
 		// remove tables we don't know about
diff --git a/lib/private/db/pgsqltools.php b/lib/private/db/pgsqltools.php
index c3ac140594d224c8c63eb09c3b9cdab3045331a7..6d17f8f40f8c02ee1c74f3f9869cdc73adc00786 100644
--- a/lib/private/db/pgsqltools.php
+++ b/lib/private/db/pgsqltools.php
@@ -21,6 +21,9 @@ class PgSqlTools {
 	*/
 	public function resynchronizeDatabaseSequences(Connection $conn) {
 		$databaseName = $conn->getDatabase();
+		$conn->getConfiguration()->
+			setFilterSchemaAssetsExpression('/^'.\OCP\Config::getSystemValue('dbtableprefix').'/');
+
 		foreach ($conn->getSchemaManager()->listSequences() as $sequence) {
 			$sequenceName = $sequence->getName();
 			$sqlInfo = 'SELECT table_schema, table_name, column_name