Sub topic 10
Troubleshooting common setup problems
This chapter helps you work out why a practice database won't start or won't accept your connection, and then fix it. It assumes you have read the earlier chapters on the three options: FreeSQL, the 26ai Free container, and Always Free Autonomous Database. You should know what FREEPDB1 is, what a wallet is, and how to run a basic docker or podman command. Examples use docker. With Podman, replace docker with podman.
A method for diagnosing setup problems
Most setup problems come from one of four layers. Locate the failing layer before you change anything.
- The runtime. The container never started, or it exited.
- The network path. Nothing is listening at the host and port you used, or a firewall blocks the connection.
- The service name. The listener is up but doesn't know the service you asked for.
- The account. The database accepted the connection, but the username, password, quota, or privileges are wrong.
The error prefix tells you which layer you are in. ORA-12541 and ORA-12514 come from the listener (layers 2 and 3). ORA-01017 and ORA-01045 come from authentication and privileges (layer 4). Python's python-oracledb driver wraps these in a DPY-6005 "cannot connect to database" message, with the underlying ORA- or DPY- cause later in the text. Read to the end of the message.
Container problems
The container exits or never appears
Start with the state of the container and the end of its log:
docker ps -a --filter name=oracle-free
docker logs --tail 50 oracle-freeIf docker ps shows Exited, the last log lines usually name the cause. Three causes are common.
- The port is taken. Docker reports
port is already allocatedoraddress already in usewhen you run the container. Another Oracle instance, or an earlier container, holds port 1521. Find the process withlsof -i :1521, or publish the container on a different host port:-p 1522:1521. Then uselocalhost:1522in your connection strings. The port inside the container stays 1521. - The name is taken. Docker reports
Conflict. The container name "/oracle-free" is already in use. Start the existing container withdocker start oracle-free, or remove it withdocker rm oracle-free. Removing a container deletes its data unless you mounted a volume (see below). - Not enough memory. The database creates its instance on first start, and the container needs a few gigabytes of memory. In Docker Desktop or a Podman machine, the VM has its own memory limit that is lower than your machine's RAM. If the log ends abruptly or the process is killed, raise the limit in the runtime's settings and start again.
Connecting too early
The first start creates the database, which takes minutes. During that time you will see these errors:
| Error | Meaning |
|---|---|
| `ORA-12541: TNS:no listener` | The listener process is not running yet, or you used the wrong port. |
| `ORA-12514: TNS:listener does not currently know of service requested` | The listener is up, but the service is not registered yet, or the name is wrong. |
| `ORA-01033: ORACLE initialization or shutdown in progress` | The instance is still opening. |
Follow the log and wait for the ready line:
docker logs -f oracle-free
# Wait for the line: DATABASE IS READY TO USE!The container runs without a restart policy by default. If your machine restarted, the container is stopped. Run docker start oracle-free. A restarted container with existing data reaches the ready state much faster than a first start, but it still needs a moment.
Checking the listener from inside the container
If the log says the database is ready and you still get ORA-12514, ask the listener which services it knows:
docker exec oracle-free lsnrctl statusLook for the service names FREE (the container database) and FREEPDB1 (the pluggable database). If your connection string uses a name that is not in this list, the listener will refuse it.
This also separates host problems from database problems. Run sqlplus inside the container, which bypasses Docker's port mapping:
docker exec -it oracle-free sqlplus sys/ChangeMe_123@localhost:1521/FREEPDB1 as sysdbaIf this works but the same command from your host fails, the problem is the port mapping or your local client, not the database. This is also the fix for sqlplus: command not found on a machine with no Oracle client: use the copy inside the container.
Wrong service: FREE versus FREEPDB1
Connecting to localhost:1521/FREE puts you in the container database root (CDB$ROOT). That is the wrong place for practice work. The symptom appears when you try to create your development user:
CREATE USER app_user IDENTIFIED BY "ChangeMe_123" QUOTA UNLIMITED ON users;
-- ORA-65096: invalid common user or role nameIn the root container, ordinary user names are rejected, because users created there are common users and must start with C##. Don't add a C## prefix to get past the error. Reconnect to the pluggable database, and then create the user:
sqlplus sys/ChangeMe_123@localhost:1521/FREEPDB1 as sysdbaConfirm where you are before you create anything:
SELECT sys_context('USERENV', 'CON_NAME') AS container_name
FROM dual;The result for the correct place is FREEPDB1. If you can reach the CDB but not the PDB, check that the PDB is open. Connect to the root and query:
SELECT name, open_mode FROM v$pdbs;FREEPDB1 should show READ WRITE. If it shows MOUNTED, open it with ALTER PLUGGABLE DATABASE FREEPDB1 OPEN; while connected to the root as SYS.
Password and login errors
Three errors are common, and each has a different cause.
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER. You connected assyswithoutas sysdba. Add it, or stop using SYS for practice work.ORA-01017: invalid username/password; logon denied. The password is wrong. In the container this has a common cause:ORACLE_PWDis read only when the database is first created. If you later start a new container with a differentORACLE_PWDagainst existing data, the stored password does not change. Connect with the old password, then reset it:
``sql ALTER USER sys IDENTIFIED BY "NewPassword_123"; ``
Also check shell quoting. A password containing $, !, or & needs single quotes in the shell, as in the docker run command in this tutorial.
ORA-01950: no privileges on tablespace 'USERS'. The user was created without a quota. YourCREATE USERstatement should includeQUOTA UNLIMITED ON users. Repair an existing user withALTER USER app_user QUOTA UNLIMITED ON users;.
Also watch for ORA-01045: user APP_USER lacks CREATE SESSION privilege; logon denied. This means the grant of DB_DEVELOPER_ROLE did not run, or it ran in the wrong container. Connect as SYS to FREEPDB1 and run the GRANT again.
Data disappears after a restart
If you remove the container and create it again, the new container starts with an empty database. To keep data, mount a volume at the Oracle data directory when you first create the container:
docker run -d --name oracle-free \
-p 1521:1521 \
-e ORACLE_PWD='ChangeMe_123' \
-v oracle-free-data:/opt/oracle/oradata \
container-registry.oracle.com/database/free:latestStopping and starting a container keeps its data. Only removing it, without a volume, deletes the data.
Autonomous Database problems
Autonomous Database failures are mostly about the connection path, because the database itself is managed for you.
Sign-in and password rules
The ADMIN password is set when you create the database. Oracle requires 12 to 30 characters, with at least one uppercase letter, one lowercase letter, and one number. It can't contain the word "admin" or a double quote. If the console rejects the password at creation, one of these rules is the cause. If you forget it, reset it from the database's detail page in the Oracle Cloud console, under the More actions menu.
Database Actions will not open for a new user
Database Actions signs in with database users. ADMIN can always sign in. A user you created with SQL, such as app_user, can't sign in to Database Actions until REST access is enabled for that schema. As ADMIN, open Database Actions, go to the Database Users page, and turn on web access for the user. Alternatively, run ORDS_ADMIN.ENABLE_SCHEMA for that user as ADMIN. After that, sign in with the new user's name and password.
Wallet and TLS errors
A client connects to Autonomous Database over a secured connection. The wallet-based option (mutual TLS) needs the downloaded wallet. Wallet problems appear as the following errors:
| Error | Likely cause | Fix |
|---|---|---|
| `ORA-12154: TNS:could not resolve the connect identifier specified` | The client can't find `tnsnames.ora`, or the alias is misspelled. | Set `TNS_ADMIN` to the unzipped wallet directory. Use an alias from `tnsnames.ora` such as `mydb_low`. |
| `ORA-28759: failure to open file` | The wallet path in `sqlnet.ora` doesn't match where you unzipped it. | Edit `WALLET_LOCATION` in `sqlnet.ora` to the real directory. |
| `ORA-01017` | The password is wrong, or you used the wallet password instead of the database password. | The wallet password protects the wallet. The database user's password is a separate secret. |
| Connection times out | A network access control list blocks your IP address. | In the database's network settings, add your public IP address, or allow access from anywhere for practice use. |
Do not change the files in the wallet except for WALLET_LOCATION. A wallet is also a credential, so don't commit it to a repository.
If you use one-way TLS instead, the database must be configured to allow it, which means mutual TLS is not required. Your connect string then also differs from the one in the wallet. Without that setting, a wallet-less client is refused.
The database stopped by itself
An Always Free Autonomous Database stops after a period of inactivity, and a database that stays stopped for long enough can be reclaimed. In the console, the lifecycle state shows Stopped. Select Start, wait for the state to return to Available, and connect again. Check Oracle's current documentation for the exact time limits, because they can change.
FreeSQL problems
FreeSQL needs no setup, so its problems are small.
- The page loads but the editor does not run statements. Browser extensions that block scripts or cookies are the usual cause. Test in a private window with extensions off.
- Your scripts are gone. Work in an unsaved session is lost when you close the tab. Sign in and save scripts you want to keep.
- A statement works elsewhere and fails in FreeSQL. FreeSQL is a shared environment with its own limits and restrictions. Statements that need administrator privileges, such as creating other users, are not available there. Use a container or Autonomous Database for those.
A quick verification after any fix
After you fix a problem, run the same short script in each environment. It confirms that DDL, DML, and queries all work:
CREATE TABLE practice_note (
id NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
body VARCHAR2(200) NOT NULL
);
INSERT INTO practice_note (body) VALUES ('Hello from my practice database');
COMMIT;
SELECT id, body FROM practice_note;If CREATE TABLE fails with ORA-01950, go back to the quota. If it fails with ORA-01031: insufficient privileges, the user is missing the developer role.
Exercise
You start the container, wait a minute, and run sqlplus app_user/ChangeMe_123@localhost:1521/FREEPDB1. You get ORA-12514: TNS:listener does not currently know of service requested. Name two checks you would do, in order, and what each result would tell you.
Show answer
First, run docker logs --tail 50 oracle-free and look for DATABASE IS READY TO USE!. If it is missing, the first-time creation is still running, so wait. Second, run docker exec oracle-free lsnrctl status and look for FREEPDB1 in the service list. If the service is listed, the name in your connection string is wrong or has a typo. If it is not listed, the pluggable database may not be open, so connect to the root as SYS and check SELECT name, open_mode FROM v$pdbs;.
Exercise
You connected to localhost:1521/FREE as SYS and CREATE USER app_user ... failed with ORA-65096. Why, and what is the correct fix?
Show answer
The service FREE is the container database root, where users must be common users with names starting with C##. The correct fix is to reconnect to the pluggable database with localhost:1521/FREEPDB1 and create app_user there, not to rename the user to C##app_user.
Exercise
A downloaded wallet is unzipped to ~/wallet. Your client reports ORA-12154. What do you check, and which setting does ORA-28759 point to instead?
Show answer
For ORA-12154, check that the TNS_ADMIN environment variable points to ~/wallet, so the client can find tnsnames.ora, and that your connect identifier is an alias that exists in that file. ORA-28759 points to the WALLET_LOCATION entry in sqlnet.ora, whose directory must match where the wallet files really are.