Comments (19)
What should Work is Bildung a docker Container and Run it locally, as described here:
https://github.com/oracle/docker-images/tree/main/OracleDatabase/SingleInstance
Did that in the past for testing
from distributedlock.
Ok I think I have a basic local setup working:
Container start command:
docker run --name oracle-distributed-lock -p 1521:1521 -p 5500:5500 -e ORACLE_PWD=???? oracle/database:18.4.0-xe
C# snippet:
var cs = new OracleConnectionStringBuilder {
UserID = "SYSTEM",
Password = ????,
DataSource = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE)))"
};
var conn = new OracleConnection(cs.ConnectionString);
conn.Open();
var command = conn.CreateCommand();
command.Parameters.Add(new OracleParameter("lockName", OracleDbType.Varchar2) { Value = "test" });
var outputParameter = new OracleParameter("returnCode", OracleDbType.Int32, ParameterDirection.Output);
command.Parameters.Add(outputParameter);
command.CommandText = @"
DECLARE
lockHandle VARCHAR2(128);
BEGIN
DBMS_LOCK.ALLOCATE_UNIQUE(:lockName, lockHandle);
:returnCode := DBMS_LOCK.REQUEST(
lockHandle,
DBMS_LOCK.X_MODE
);
END;";
command.ExecuteNonQuery();
outputParameter.Value.Dump();
from distributedlock.
No, you don't need it, does not have any effect, see https://docs.oracle.com/html/E10927_01/OracleCommandClass.htm
This method is a no-op
Another source: https://stackoverflow.com/a/33667968
from distributedlock.
@odin568 I've published a beta release of the Oracle package here: https://www.nuget.org/packages/DistributedLock.Oracle/1.0.0-beta001 . Can you try it out in your environment?
Thanks!
from distributedlock.
Will do this week! Thank you!
from distributedlock.
Thanks for testing @odin568 ! From some quick googling I found https://stackoverflow.com/questions/10870787/oracle-pl-sql-dbms-lock-error which suggests that your solution to the permissions issue is the correct one.
I've added this section to the Oracle docs: https://github.com/madelson/DistributedLock/blob/oracle/docs/DistributedLock.Oracle.md#setup
I'll aim to publish a stable version of the package tomorrow!
from distributedlock.
Released in DistributedLock.Oracle 1.0.0 / DistributedLock 2.3.0
from distributedlock.
May be easier after appveyor/ci#31
from distributedlock.
Would love to see someday 😀
from distributedlock.
@odin568 what has held me back in the past is not having a good way to install an Oracle db on my windows machine for doing development. Do you know if this is now supported or do you have another recommended workflow for this?
from distributedlock.
I am Happy to Support you with Testing, Just Ping me
from distributedlock.
Thanks @odin568 that would be great. It will take me a bit to actually code up the implementation but I'll let you know when a prerelease is available.
In the meantime, if you happen to know how to query for idle sessions (connections that are open but not doing running any commands) in Oracle that would be super helpful; I'll need it for my testing.
from distributedlock.
There are two main global tables which should have the information: gv$session s, v$process
Found here a page with good examples. Hope that helps :-)
from distributedlock.
Thanks @odin568!
Another Oracle question for you: do you typically call OracleCommand.Prepare()
before executing commands? For some database drivers this is important while for others it isn't.
from distributedlock.
Running into issues getting command cancellation to work properly, see oracle/dotnet-db-samples#211
from distributedlock.
Hmm... Is the answer there a Blocker?
from distributedlock.
@odin568 sorry thought I had replied here earlier. No it is not a blocker and I'm continuing to progress with the implementation.
However, this will limit the functionality somewhat. The main thing we lose is the ability to cancel lock requests which is pretty valuable. As a workaround for that, I'm thinking of implementing longer lock requests using a loop with chances to check the cancellation token in between.
from distributedlock.
Update on this:
While I did get oracle working on my machine through docker, I've found the docker-based oracle to be incredibly unreliable. I have to restart the database frequently and constantly encounter issues like connection timeouts. Perhaps there is a fix for this (e. g. some configuration I'm missing). I'd be happy to try things but for now that is blocking further progress.
The other avenue I'm exploring is using oracle cloud's free tier. Unfortunately that is running into issues as well (see oracle/dotnet-db-samples#225). EDIT: Looks like this direction is promising.
For future reference, work done is here: https://github.com/madelson/DistributedLock/compare/oracle?expand=1
from distributedlock.
So first the good thing: On one schema I have on one of our oracles, it works great.
On the same database, different schema, I get
Unhandled exception. Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-06550: line 5, column 21:
PLS-00201: identifier 'SYS.DBMS_LOCK' must be declared
ORA-06550: line 5, column 21:
PL/SQL: Statement ignored
I think i would need to grant something like
connect as sys
grant execute on SYS.DBMS_LOCK to someuser;
The schema where it works is our historic "god" schema. Newer stuff we build more modular and have dedicated schemas with only the rights needed. So probably that is something to resolve on my end, but perhaps a topic for documentation.
So far thanks a lot - will make some more tests but it looks promising!!
from distributedlock.
Related Issues (20)
- Postgres: consider switching to positional parameter style
- Postgres: consider constructor with NpgsqlDatasource
- ZooKeeperNetEx connection loss issue: an acquired lock seems is not released HOT 50
- Azure: create the container on the fly if it does not exist HOT 4
- Increase in lost lock after upgrading to .NET 7, EF Core 7 and Microsoft.Data.SqlClient 5.0.1 HOT 21
- Add custom data to AzureBlobLeaseDistributedLock HOT 10
- Redis: RedisScript (LuaScript) execution error - CultureInfo problem HOT 7
- DistributedLock.Azure: Remove MaxNonInfiniteLeaseDuration HOT 2
- Use Distributed lock to manage multiple calls to the same Azure function HOT 2
- Postgres distributed lock using PgBouncer connection pooler HOT 8
- About Distribute Locking System using Redis HOT 2
- RobiniaDocs API Explorer HOT 8
- Postgres - Multiple threads successfully acquire the same lock HOT 3
- Concurrency with Redis Semaphore HOT 2
- Error acquiring lock on PostgreSQL when using Npgsql 8.0 HOT 5
- PostgreSQL — Exception while using "AcquireAsync" or "TryAcquireAsync" multiple times HOT 3
- DistributedLock.Azure is updated but not released to NuGet HOT 1
- Document Support for Key Prefixes in RedisDistributedLock HOT 3
- Adopt central package management HOT 2
- Add build checks for AOT compat HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from distributedlock.