简体   繁体   中英

ORA-00955 name is already used by an existing object Error when Update-Database Code First Migration ASP.NET MVC

I am trying to use Oracle ManagedAccess Client driver to user Oracle Database With ASP.NET MVC 5

Here is My Context:

using System.Configuration;
using Domain.Entities;
using Oracle.ManagedDataAccess.Client;
using Oracle.ManagedDataAccess.EntityFramework;
using System.Collections.Specialized;
namespace Domain.Data
{
    using System;
    using System.Data.Entity;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;

    public partial class SptsOracleDbContext : DbContext
    {
        public SptsOracleDbContext()
            : base(new OracleConnection(ConfigurationManager.ConnectionStrings["SptsOracleDbContext"].ConnectionString), true)
                    { 

                    } 

        public DbSet<BranchType> BranchTypes { get; set; }
        public DbSet<Branch> Branches { get; set; }
        public DbSet<StaffStatu> StaffStatus { get; set; }
        public DbSet<ManagerialTitle> ManagerialTitles { get; set; }
        public DbSet<AcademicTitle> AcademicTitles { get; set; }
        public DbSet<Hospital> Hospitals { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {

        base.OnModelCreating(modelBuilder);
            modelBuilder.HasDefaultSchema("SPTS");
            modelBuilder.Ignore<Hospital>();
        }
    }
}

When I try to migrate with update-database command from Package Manager Console It gives me this error:

ORA-00955 name is already used by an existing object 

When I check if a table is already created,but there is no created table.

How can I Solve This issue?

Many Thanks For Helps

It looks like there is another object by the same name. You can check it using this query:

select *
from   user_objects
where  object_name = 'yourObject'

and then you can drop it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM