I am struggling with an error when using create pluggable database from command. My config is:
HOST_A - source CDB with couple of PDBs with ASM
HOST_B - destination CDB with couple of existing PDBs with ASM
I would like to create a new pluggable database on HOST_B using dblink to HOST_A and "create pluggable database X from dbLink" statement, however I'm getting this error:
ORA-65169 Error encountered while attempting to copy file -- path to .DBF file on HOST_A
ORA-17628: Oracle error 19505 returned by remote Oracle server
ORA-19505: failed to identify file ""
I have checked above path to .dbf file and owner on HOST_A - it exists and has correct owner. Also, HOST_B has enough space to create new snapshot. What makes that even more weird, is that I have very similar HOST_C with same init parameters and it works without any problem.
I noticed on HOST_B oracle has copied these files and placed them under valid ASM mount point with correct name etc, however create pluggable database still fails.
Any ideas?
Related
I need to set up a new Oracle XE database after the server holding our old XE testing database suddenly died.
To do this I do have a .dmp file from when the database was functional.
The server is a Windows machine.
The database structure was originally created in an Oracle 11g environment but the server had been updated since so the .dmp was created in a 19c environment.
The new Oracle XE database I'm trying to set up is 21c.
The installation of Oracle XE worked, but trying to create a PDB fails with ORA-65100 "missing or invalid path prefix".
Issued the following statements in sqlplus via command line:
create pluggable database DATABASE_MAIN
admin user USERNAME identified by PASSWORD
storage (maxsize 2G)
default tablespace TS_DATA
datafile '/disk1/Oracle/product/21c/dbhomeXE/pdbs/DATABASE_MAIN/DATABASE_MAIN.dbf' size 250M autoextend on
path_prefix = '/disk1/Oracle/product/21c/dbhomeXE/pdbs/DATABASE_MAIN/'
file_name_convert = ('/disk1/Oracle/product/21c/dbhomeXE/pdbs/pdbseed', '/disk1/Oracle/product/21c/dbhomeXE/pdbs/DATABASE_MAIN/');
So this line is currently throwing the error:
path_prefix = '/disk1/Oracle/product/21c/dbhomeXE/pdbs/DATABASE_MAIN/'
Things I've tried to get around the error:
ran cmd as administrator in case its a simple permission issue
created the missing folders myself ( /pdbs/DATABASE_MAIN )
replaced /disk1 with /diskc to see if it makes a difference
omitted /disk1 and started the string with /Oracle
tried a different path ( /disk1/Oracle/product/21c/pdbs/DATABASE_MAIN/ )
removed the trailing '/' at the end of the path prefix
Searching online for what invalidates the path prefix sadly didn't give me any answers however Oracle's documentation states the following as a valid example path prefix:
PATH_PREFIX = '/disk1/oracle/dbs/salespdb/'
This is my first time interacting with this "new" Oracle database structure of CDB/PDB as I've only worked with older databases so far that were built with the user/schema structure.
As noted in the comments, the issue was due to the UNIX style paths rather than Windows styled.
So changing the paths from
/disk1/foo/bar
to
C:\foo\bar
resolved the issue.
Here's the functional create-statement as run in sqlplus:
create pluggable database DATABASE_MAIN
admin user USERNAME identified by PASSWORD
storage (maxsize 2G)
default tablespace TS_DATA
datafile 'C:\Oracle\product\21c\oradata\XE\DATABASE_MAIN\DATABASE_MAIN.dbf' size 250M autoextend on
path_prefix = 'C:\Oracle\product\21c\oradata\XE\DATABASE_MAIN'
file_name_convert = ('C:\Oracle\product\21c\oradata\XE\pdbseed','C:\Oracle\product\21c\oradata\XE\DATABASE_MAIN');
The problem is when I try to install my setup in other PC it gave me errors of database file .mdf
How can I make my setup goes with database auto
T tried a lot of ways to create my setup. Yes I created it but it work just in my PC not in other.
Here is my last connection string:
ReadOnly con As New SqlClient.SqlConnection("Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True")
could not open new database 'C:/............./database.mdf' create database is aborted.
an attempt attach an auto-named database file 'C:/............./database.mdf ' failed.A database with the same name exists, or specified file cannot be opened ,or it is located on UNC share.
file activation failure, the physical file name 'C:/............./database_log.ldf' may be incorrect.
the log cannot be rebuilt when the primary file is read-only.
I'm new to altibase hdb. I was installed altibase hdb with the instructions from here:
http://support.altibase.com/manual/en/631b/html/Installation/index.html
after using the links guides I was able to start the server well but I could not create the database via the recommended command:
CREATE DATABASE mydb INITSIZE=10M NOARCHIVELOG CHARACTER SET KSC5601 NATIONAL CHARACTER SET UTF16;
after some manipulation I found out that the datafiles and anchorlog files were exist here:
$ALTIBASE_HOME\Altibase\altibase-HDB-server-6.3.1\logs
$ALTIBASE_HOME\Altibase\altibase-HDB-server-6.3.1\dbs
So I cleaned them and now I can use the command above to create the database. but if I just rename the databasename to forexample mydbb instead of mydb the command does not work and get me the following error:
Invalid Database Name. Check The Properties and retry.
So what's problem with the database name? what's the difference between mydb and mydbb????
Keep in mind that this same issue should occur even if you install ALTIBASE HDB on Linux.
If you are going to change the database name using the "CREATE DATABASE" command, you must also change the DB_NAME property in your $ALTIBASE_HOME/conf/altibase.properties file to match.
Once you do so, the command you specified should work fine.
Full error below:
Error 1 SQL01268: .Net SqlClient Data Provider: Msg 1834, Level 16, State 1, Line 1 The file 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\testdatabase.mdf' cannot be overwritten. It is being used by database 'testdatabase'. SchemaCompare5 25 0
I read about this on some forums and quite a few people were getting this and supposedly for some it had to do with parameterising the file path name to the db etc. or ticking "ignore file names and path for files and log files" prior to doing the comparison - this I have tried to no avail.
Someone else who has the same/similar issue: http://social.msdn.microsoft.com/Forums/en/vstsdb/thread/5a8b8c52-adb4-4a5a-95ed-09ad22bacf60
Basically for me I seem to get this error irrespective of which databases I am using for target and source. Say even if I create a new database with one table and another database with no tables and different name and try to update the schema of the database with no tables using the db with the single table it still gives me the error. Almost like SQL server express has gone nuts. I remember using the schema comparison tool before with no trouble. All db connections were created, tried many ways to do this to no avail ie: pointing to copy of *.mdf db in another folder or deleting things from the DATA folder in mysql directory in program files etc.
Also believe I read someone had solved a similar issue be deleting some files the scheme
comparison tool creates, think they were *.sql type not sure which ones though.
The problem arises because the database files already exist.
Try the below within the Visual Studio database project.
Create the schema comparison.
Go to menu: Data > Schema Compare > Export to > Editor
Once the script has been created delete the alter database commands that add the physical files. Then create a connection, switch to SQLCMD mode (making sure you have focus on the script) and execute the script.
To switch to SQLCMD mode access: Data > Transact-SQL Editor > SQLCMD Mode
If the target DB already exists, just delete through Management Studio first before you deploy for the first time.
I had already created the database manually through SQL Server Management Studio when I was establishing the original connection when creating the Database Project via the SQL Server 2008 Wizard in VS. It wouldn't allow me to continue until it could detect that the database existed. Then once I got to the Deploy step for the first time, it threw the same error as above. I just went into Management Studio and deleted the DB, then tried to deploy and it worked fine. Interestingly, it's deploying every time now without me having to go in and delete it every time.
RESTORE DATABASE B FROM DISK = 'A.bak'
WITH MOVE 'DataFileLogicalName' TO 'C:\SQL Directory\DATA\B.mdf',
MOVE 'LogFileLogicalName' TO 'C:\SQL Directory\DATA\B.ldf',
REPLACE ---> Needed if database B already exists
I'm learning ASP.NET MVC 3 with Entity Framework Code First. I'm following a tutorial and I downloaded the corresponding solution for testing on my local machine. Now, something I didn't understand very well is about the automatic creation of the database (if this one didn't exist yet on disk). The very first time I run the application, the database is created for me. That's ok.
Here is the section in Web.config
<add name="BlogContext"
connectionString="Data Source=.\SQL2008;Initial Catalog=CodeFirstMVC.mdf;Integrated Security=SSPI"
providerName="System.Data.SqlClient" />
But I have two problems:
1st. For testing purpose, I deleted the database on disk and run again the solution. I thought that the database would be automatically created but I was wrong: I got the error message below:
{"Unable to open the physical file \"c:\\Program Files\\Microsoft SQL Server\\MSSQL10.SQL2008\\MSSQL\\DATA\\CodeFirstMVC.mdf.mdf\". Operating system error 2: \"2(failed to retrieve text for this error. Reason: 15105)\".\r\nCannot open database \"CodeFirstMVC.mdf\" requested by the login. The login failed.\r\nLogin failed for user 'sa'.\r\nFile activation failure. The physical file name \"c:\\Program Files\\Microsoft SQL Server\\MSSQL10.SQL2008\\MSSQL\\DATA\\CodeFirstMVC.mdf_log.LDF\" may be incorrect."}
I noticed that if I changed the file name in my Web.config then the database is again successfully created. Can you explain me? Why do I have to change the database name to get it running again?
2nd. The database is created in the folder located in C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA. I would like to store my database in the App_Data directory. How can I proceed?
Initial catalog is not path to file. It is the name of database. AttachDbFilename is used to specify the file so your connection string should look like:
Data Source=.\SQL2008;Initial Catalog=CodeFirstMVC;AttachDbFilename=|DataDirectory|CodeFirstMVC.mdf;Integrated Security=SSPI
Where |DataDirectory| instructs SQL server to use local application data directory instead of global SQL Server data directory. Local data directory for web application is App_Data.
Edit:
I just noticed that you are probably using full SQL server instead of SQL server express. As I know creating database in App_Data automatically is feature of SQL server express. That also explains first error because SQL server created database called CodeFirstMVC.mdf and stored the database in its global data directory within CodeFirstMVC.mdf.mdf file and transaction log in CodeFirstMVC.mdf.ldf file. It also registered that database internally. By deleting files you didn't remove database from SQL server. You just break its functionality but SQL server still believes that the database exists. That is also reason why you have to change the name to make it work.