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');
I'm running the following T-SQL statement from SSMS
CREATE DATABASE SomeDB
GO
With a result
Commands completed successfully.
But no database is actually created. I've been researching and came across this post which has the same behavior. The solution for that post was the run the script under an account with rights to modify sys.databases.
However, the user I'm running the script under and connecting to the DB as is in role sysadmin which is more than enough to create a database.
Any ideas as to what's going on here?
EDIT 1
If I change the script (and this is the whole script, with a DB actually called SomeDB to test), to the following
CREATE DATABASE SomeDB
GO
USE SomeDB
I get the following in SSMS's Messages panel.
Msg 911, Level 16, State 1, Line 56
Database 'SomeDB' does not exist. Make sure that the name is entered correctly.
If I change this to
CREATE DATABASE SomeDB
GO
SELECT * from sys.databases
I see the following in the Messages panel
Commands completed successfully.
But there is no Results panel. This would imply that access to sys.databases is restricted but it's weird that there's no error message.
EDIT 2
Taking this further and trying to narrow down the issue, I've run the following via an unelevated command line;
sqlcmd -S .\SQLExpress2014 -Q "CREATE DATABASE SomeDB"
And this time the database does exist. This narrows down the issue to SSMS itself rather than SQL Server or a syntax quirk.
Solution: Run SSMS as Admin.
Despite CREATE DATABASE working fine via an unelevated command line, SSMS requires admin privileges to do the same. The silent failure is...a possible bug?
I'll do further research on this but my working hypothesis is that when executing via a command line, it uses the SQL Server Windows Service instance's credentials (Network Service for older versions, NT Service\MSSQL$SQLEXPRESS for later versions - there's a strong whiff of a permissions issue here), to write to the %programfiles% folder. SSMS uses the currently logged in user (unelevated) if connecting via a Windows account. Without elevation, there is no write access to %programfiles%.
Still though, even if this is the case (to be verified), there should still be an access error when executing CREATE DATABASE in this context.
Right click on databases folder in Object explorer and refresh. Then check wheter DB exists or not..
1.- Run SSMS as Admin and create the database
2.- After the command shows it succesfully created the database, try disconnecting from the object explorer and connect again to see if it shows up.
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.
I want to install DB2 UDW in my machine for learning purpose but I am having a hard time configuring the local instance. Any help would be highly appreciated.
I installed DB2 express edition -c . I have selected all the default choices. I am trying to connect using IBM data Studio 4.1, In the "DB2 first Steps" GUI I have chosen to create SAMPLE Database. I am getting the below error
Creating database "SAMPLE" on path "C:"...
Existing "SAMPLE" database found...
The "-force" option was not specified...
Attempt to create the database "SAMPLE" failed
'db2sampl' processing complete.
I tried connecting from Data Studio using the following options
Database- SAMPLE
Port- 50000
host - localhost
Error I am getting
Explanation:
An attempt was made to access a database that was not found, has not been started, or does not support transactions.
User response:
Ensure that the specified database name exists in the system database directory. If the database name does not exist in the system database directory, either the database does not exist or the database name has not been cataloged. If needed, issue a db2start command and then resubmit the current command.
SQL4499N A fatal error occurred that resulted in a disconnect from the data source.
SQLSTATE: 08004
Problem is I am having zero knowledge in DB2. If I need to run db2start command from where I should run this? Please help
Probably the instance is not started.
Once you have installed DB2, you need to have an started instance in order to use any database. The instance could be created at the same time of the installation. You can verify which instances exist in your computer by issuing:
/opt/IBM/db2/V10.1/instance/db2ilist
The output should give you a set of users, where an instance has been configured.
You can change to that user and start the instance. For example if the user is db2inst1
su - db2inst1
db2start
Once the instance is started, you can now create a database and then connect to it.
For some weird reason I'm having problems executing a bulk insert.
BULK INSERT customer_stg
FROM 'C:\Users\Michael\workspace\pydb\data\andrew.out.txt'
WITH
(
FIRSTROW=0,
FIELDTERMINATOR='\t',
ROWTERMINATOR='\n'
)
I'm confident after reading this that I've setup my user role correctly, as it states...
Members of the bulkadmin fixed server role can run the BULK INSERT statement.
I have set the Login Properties for the Windows Authentication correctly (as seen below).. to grant server-wide permissions on bulkadmin
(source: iforce.co.nz)
And the command EXEC sp_helpsrvrolemember 'bulkadmin' tells me that the information above was successful, and the current user Michael-PC\Michael has bulkadmin permissions.
(source: iforce.co.nz)
But even though I've set everything up correctly as far as I know, I'm still getting the error. executing the bulk insert directly from SQL Server Management Studio.
Msg 4861, Level 16, State 1, Line 2
Cannot bulk load because the file "C:\Users\Michael\workspace\pydb\data\andrew.out.txt" could not be opened. Operating system error code 5(Access is denied.).
which doesn't make sense because apparently bulkadmins can run the statement, am I meant to reconfigure how the bulkadmin works? (I'm so lost). Any ideas on how to fix it?
This error appears when you are using SQL Server Authentication and SQL Server is not allowed to access the bulk load folder.
So giving SQL server access to the folder will solve the issue.
Here is how to:
Go to the folder right click ->properties->Security tab->Edit->Add(on the new window) ->Advanced -> Find Now. Under the users list in the search results, find something like SQLServerMSSQLUser$UserName$SQLExpress and click ok, to all the dialogs opened.
I don't think reinstalling SQL Server is going to fix this, it's just going to kill some time.
Confirm that your user account has read privileges to the folder in question.
Use a tool like Process Monitor to see what user is actually trying to access the file.
My guess is that it is not Michael-PC\Michael that is trying to access the file, but rather the SQL Server service account. If this is the case, then you have at least three options (but probably others):
a. Set the SQL Server service to run as you.
b. Grant the SQL Server service account explicit access to that folder.
c. Put the files somewhere more logical where SQL Server has access, or can be made to have access (e.g. C:\bulk\).
I suggest these things assuming that this is a contained, local workstation. There are definitely more serious security concerns around local filesystem access from SQL Server when we're talking about a production machine, of course this can still be largely mitigated by using c. above - and only giving the service account access to the folders you want it to be able to touch.
I had the same problem SSIS 2012 and the solution was to use Windows Authentication. I was using SQL authentication with the sa user.
Go to start run=>services.msc=>SQL SERVER(MSSQLSERVER) stop the service
Right click on SQL SERVER(MSSQLSERVER)=> properties=>LogOn Tab=>Local System Account=>OK
Restart the SQL server Management Studio.
Try giving the folder(s) containing the CSV and Format File read permissions for ‘MSSQLSERVER’ user (or whatever user the SQL Server service is set to Log On As in Windows Services)
This is what worked for me:
Log on SSIS with Windows authentication.
1. Open services and find MSSQL NT Service account name and copy it:
2. Open folder from which SQL server should read from. Security - Group or user names tab - Add and paste there copied account:**
You will probably get "Multiple names found error", just select MSSQL user:
Your BULK INSERT query should run fine now.
If problem persists try adding SQL Server Agent account to folder permissions in same way.
Make sure you restart MSSQL server in services after you are done.
This is quite simple the way I resolved this problem:
open SQL Server
right click on database (you want to be backup)
select properties
select permissions
select your database role (local or cloud)
in the you bottom you will see explicit permissions table
find " backup database " permission and click Grant permission .
your problem is resolved .
sometimes this can be a bogus error message, tried opening the file with the same account that it is running the process. I had the same issue in my environment and when I did open the file (with the same credentials running the process), it said that it must be associated with a known program, after I did that I was able to open it and run the process without any errors.
Make sure the file you're using ('C:\Users\Michael\workspace\pydb\data\andrew.out.txt') is on the SQL server machine and not the client machine running MSSMS.
1) Open SQL
2) In Task Manager, you can check which account is running the SQL - it is probably not Michael-PC\Michael as Jan wrote.
The account that runs SQL need access to the shared folder.
I have come to similar question when I execute the bulk insert in SSMS it's working but it failed and returned with "Operation system failure code 5" when converting the task into SQL Server Agent.
After browsing lots of solutions posted previously, this way solved my problem by granting the NT SERVER/SQLSERVERAGENT with the 'full control" access right to the source folder.
Hope it would bring some light to these people who are still struggling with the error message.
In our case it ended up being a Kerberos issue. I followed the steps in this article to resolve the issue: https://techcommunity.microsoft.com/t5/SQL-Server-Support/Bulk-Insert-and-Kerberos/ba-p/317304.
It came down to configuring delegation on the machine account of the SQL Server where the BULK INSERT statement is running. The machine account needs to be able to delegate via the "cifs" service to the file server where the files are located. If you are using constrained delegation make sure to specify "Use any authenication protocol".
If DFS is involved you can execute the following Powershell command to get the name of the file server:
Get-DfsnFolderTarget -Path "\\dfsnamespace\share"